What steps will reproduce the problem? What is the expected result? The app must work properly. What do you see instead? | |
What I have done?
1) Able to run AppRtcDemo at local server and Its working fine between browsers but not works between Android Native ApprtcApp to browser.
Reference : http://www.webrtc.org/reference/getting-started
2) I installed latest rfc5766TurnServer recommended by webrtc. I got success to run turn server.
Reference : http://code.google.com/p/rfc5766-turn-server/
I do following changes to ApprtcDemo (web) to work with my Turn server
1) apprtc.py
replace
turn_url = 'https://computeengineondemand.appspot.com/' turn_url = turn_url + 'turn?' + 'username=' + user + '&key=4080218913'
with
Point to my turn server
turn_url = 'http://192.168.5.85:3478/?service=turn&username=biraj'
2) index.html
replace
var pcConfig = {{ pc_config|safe }};
with
var pcConfig = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}, {"url":"turn:bi...@192.168.5.85:3479", "credential":"0x5b04123c3eec4cf0be64ab909bb2ff5b"}]};
I do following changes to ApprtcDemo (web) to work with my Turn server
1)AppRTCDemoActivity.java
replace
roomInput.setText("https://apprtc.appspot.com/?r=");
with my local apprtc server.
roomInput.setText("http://192.168.5.86:8080/?r=");
2) AppRTCClient.java
In private PeerConnection.IceServer requestTurnServer(String url){}
function
replace
connection.addRequestProperty("origin", "https://apprtc.appspot.com");
with
connection.addRequestProperty("origin", "http://192.168.5.86:8080");
3) /assets/channel.html
replace
<script src="https://apprtc.appspot.com/_ah/channel/jsapi"></script>
with
<script src="http://192.168.5.86:8080/_ah/channel/jsapi"></script>
Log Produced between browsers.
Initializing; room=testroom. main.js:32
Opening channel. main.js:51
Requested access to local media with mediaConstraints:
'{"video":true,"audio":true}' main.js:129
Channel opened. main.js:257
User has granted access to local media. main.js:290
S->C: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:124254220 1 udp 2113937151 192.168.5.74 32831 typ host generation 0\r\n"} main.js:262
S->C: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:124254220 2 udp 2113937151 192.168.5.74 32831 typ host generation 0\r\n"} main.js:262
S->C: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:124254220 1 udp 2113937151 192.168.5.74 32831 typ host generation 0\r\n"} main.js:262
S->C: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:124254220 2 udp 2113937151 192.168.5.74 32831 typ host generation 0\r\n"} main.js:262
S->C: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:1239680252 1 tcp 1509957375 192.168.5.74 0 typ host generation 0\r\n"} main.js:262
S->C: {"sdp":"v=0\r\no=- 206665166771500886 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84\r\nm=audio 1 RTP/SAVPF 111 103 0 8 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufragZvPr+IUOsfQIsJd\r\na=ice-pwdeEnKpyvUgVJ2MsPftWxvIlt\r\na=ice-options:google-ice\r\na=fingerprintha-256 BE:80:FB:07:32:53:A8:A6:52:95:18:81:7C:1E:32:F2:42:1F:37:5B:E8:2F:77:34:F0:43:32:2F:71:15:3ED\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietfarams:rtp-hdrextsrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:0PGKgPLQ3GjY0LvqVwg5O3z00sPI0/HCjpNmGqhY\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=ssrc:3938331154 cname:iNx+PmHVSRLIVyWF\r\na=ssrc:3938331154 msid:Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84 Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84a0\r\na=ssrc:3938331154 mslabel:Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84\r\na=ssrc:3938331154 label:Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84a0\r\nm=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufragZvPr+IUOsfQIsJd\r\na=ice-pwdeEnKpyvUgVJ2MsPftWxvIlt\r\na=ice-options:google-ice\r\na=fingerprintha-256 BE:80:FB:07:32:53:A8:A6:52:95:18:81:7C:1E:32:F2:42:1F:37:5B:E8:2F:77:34:F0:43:32:2F:71:15:3ED\r\na=setup:actpass\r\na=mid:video\r\na=extmap:2 urn:ietfarams:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=sendrecv\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:0PGKgPLQ3GjY0LvqVwg5O3z00sPI0/HCjpNmGqhY\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 goog-remb\r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=ssrc:3697912854 cname:iNx+PmHVSRLIVyWF\r\na=ssrc:3697912854 msid:Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84 Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84v0\r\na=ssrc:3697912854 mslabel:Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84\r\na=ssrc:3697912854 label:Mem0i9HsefdXKa9PUcYVzpTYJh5ubK6F8k84v0\r\n","type":"offer"} main.js:262
Creating PeerConnection. main.js:161
Created RTCPeerConnnection with:
config: '{"iceServers"{"url":"stuntun.l.google.com:19302"},{"url":"turn:bi...@192.168.5.85:3479","credential":"0x5b04123c3eec4cf0be64ab909bb2ff5b"}]}';
constraints: '{"optional"{"DtlsSrtpKeyAgreement":true}]}'. main.js:142
Adding local stream. main.js:163
No preference on audio send codec. main.js:545
Sending answer to peer. main.js:194
Remote stream added. main.js:341
Set session description success. main.js:311
Prefer audio receive codec: opus/48000 main.js:557
C->S: {"sdp":"v=0\r\no=- 2011873284792728586 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVS\r\nm=audio 1 RTP/SAVPF 111 103 0 8 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:RRghcikyDatYg13b\r\na=ice-pwd:8DqYBccZRGnF5N67QEm6WLIy\r\na=fingerprintha-256 B5:23:4F:68:B4:60:23:F0:7A:70:390:A8:70:FB:8A:E6:EF9:41:A2:13:2E:2E:59A:40:CD:37:91:0F:08\r\na=setup:active\r\na=mid:audio\r\na=extmap:1 urn:ietfarams:rtp-hdrextsrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=ssrc:558656959 cname:wMUFRWob/2cxYNvz\r\na=ssrc:558656959 msid:xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVS xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVSa0\r\na=ssrc:558656959 mslabel:xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVS\r\na=ssrc:558656959 label:xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVSa0\r\nm=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:RRghcikyDatYg13b\r\na=ice-pwd:8DqYBccZRGnF5N67QEm6WLIy\r\na=fingerprintha-256 B5:23:4F:68:B4:60:23:F0:7A:70:390:A8:70:FB:8A:E6:EF9:41:A2:13:2E:2E:59A:40:CD:37:91:0F:08\r\na=setup:active\r\na=mid:video\r\na=extmap:2 urn:ietfarams:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 goog-remb\r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=ssrc:250028088 cname:wMUFRWob/2cxYNvz\r\na=ssrc:250028088 msid:xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVS xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVSv0\r\na=ssrc:250028088 mslabel:xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVS\r\na=ssrc:250028088 label:xsEc0bBit2mBH9pXHpnic1sFVJrEHy7UunVSv0\r\n","type":"answer"} main.js:226
Set session description success. main.js:311
C->S: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:3362589025 1 udp 2113937151 192.168.5.69 45669 typ host generation 0\r\n"} main.js:226
C->S: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:3362589025 1 udp 2113937151 192.168.5.69 45669 typ host generation 0\r\n"} main.js:226
C->S: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:2263807377 1 tcp 1509957375 192.168.5.69 0 typ host generation 0\r\n"} main.js:226
C->S: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:2263807377 1 tcp 1509957375 192.168.5.69 0 typ host generation 0\r\n"} main.js:226
S->C: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:1239680252 2 tcp 1509957375 192.168.5.74 0 typ host generation 0\r\n"} main.js:262
S->C: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:1239680252 2 tcp 1509957375 192.168.5.74 0 typ host generation 0\r\n"} main.js:262
End of candidates. main.js:336
S->C: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:1239680252 1 tcp 1509957375 192.168.5.74 0 typ host generation 0\r\n"} main.js:262
Initializing; room=romio. main.js:32
Opening channel. main.js:51
Requested access to local media with mediaConstraints:
'{"video":true,"audio":true}' main.js:129
Channel opened. main.js:257
User has granted access to local media. main.js:290
S->C: {"type":"offer","sdp":"v=0\r\no=- 5807229488589666472 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS ARDAMS\r\nm=audio 1 RTP\/SAVPF 103 111 9 102 0 8 106 105 13 127 126\r \nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:tB6VbGg0o9g64TSU\r\na=ice-pwd:2K7H2eXkstEA2KLyEI+NXyvV\r\na=ice-options:google-ice\r\na=fingerprintha-1 74:6DE:6E:8D:91:42:E0:A7:A17:69:F05:CD1:49:79:25:A8\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietfarams:rtp-hdrextsrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:0FSEkDwI1m\/CEqsAFjAb5cKqHhIb1H0jNRNl\/fuw\r\na=rtpmap:111 opus\/48000\/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC\/16000\r\na=rtpmap:9 G722\/16000\r\na=rtpmap:102 ILBC\/8000\r\na=rtpmap:0 PCMU\/8000\r\na=rtpmap:8 PCMA\/8000\r\na=rtpmap:106 CN\/32000\r\na=rtpmap:105 CN\/16000\r\na=rtpmap:13 CN\/8000\r\na=rtpmap:127 red\/8000\r\na=rtpmap:126 telephone-event\/8000\r\na=maxptime:60\r\na=ssrc:1908466135 cname:ge10wiRoHcESV5iJ\r\na=ssrc:1908466135 msid:ARDAMS ARDAMSa0\r\na=ssrc:1908466135 mslabel:ARDAMS\r\na=ssrc:1908466135 label:ARDAMSa0\r\nm=video 1 RTP\/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:tB6VbGg0o9g64TSU\r\na=ice-pwd:2K7H2eXkstEA2KLyEI+NXyvV\r\na=ice-options:google-ice\r\na=fingerprintha-1 74:6DE:6E:8D:91:42:E0:A7:A17:69:F05:CD1:49:79:25:A8\r\na=setup:actpass\r\na=mid:video\r\na=extmap:2 urn:ietfarams:rtp-hdrext:toffset\r\na=extmap:3 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time\r\na=sendrecv\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:0FSEkDwI1m\/CEqsAFjAb5cKqHhIb1H0jNRNl\/fuw\r\na=rtpmap:100 VP8\/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 goog-remb\r\na=rtpmap:116 red\/90000\r\na=rtpmap:117 ulpfec\/90000\r\na=ssrc:4115278321 cname:ge10wiRoHcESV5iJ\r\na=ssrc:4115278321 msid:ARDAMS ARDAMSv0\r\na=ssrc:4115278321 mslabel:ARDAMS\r\na=ssrc:4115278321 label:ARDAMSv0\r\n"} main.js:262
Creating PeerConnection. main.js:161
Created RTCPeerConnnection with:
config: '{"iceServers"{"url":"stuntun.l.google.com:19302"},{"url":"turn:bi...@192.168.5.85:3479","credential":"0x5b04123c3eec4cf0be64ab909bb2ff5b"}]}';
constraints: '{"optional"{"DtlsSrtpKeyAgreement":true}]}'. main.js:142
Adding local stream. main.js:163
No preference on audio send codec. main.js:545
Sending answer to peer. main.js:194
Remote stream added. main.js:341
Set session description success. main.js:311
Prefer audio receive codec: opus/48000 main.js:557
C->S: {"sdp":"v=0\r\no=- 8014258827249529117 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS 60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehq\r\nm=audio 1 RTP/SAVPF 111 103 0 8 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:LxQGjYWyvRKUf76s\r\na=ice-pwd:1AgqUaxfSPUof/lo+yxDzFFP\r\na=fingerprintha-256 B5:23:4F:68:B4:60:23:F0:7A:70:390:A8:70:FB:8A:E6:EF9:41:A2:13:2E:2E:59A:40:CD:37:91:0F:08\r\na=setup:active\r\na=mid:audio\r\na=extmap:1 urn:ietfarams:rtp-hdrextsrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=ssrc:1763302589 cname:h6mgIOb+/A6A3i/W\r\na=ssrc:1763302589 msid:60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehq 60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehqa0\r\na=ssrc:1763302589 mslabel:60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehq\r\na=ssrc:1763302589 label:60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehqa0\r\nm=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:LxQGjYWyvRKUf76s\r\na=ice-pwd:1AgqUaxfSPUof/lo+yxDzFFP\r\na=fingerprintha-256 B5:23:4F:68:B4:60:23:F0:7A:70:390:A8:70:FB:8A:E6:EF9:41:A2:13:2E:2E:59A:40:CD:37:91:0F:08\r\na=setup:active\r\na=mid:video\r\na=extmap:2 urn:ietfarams:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 goog-remb\r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=ssrc:1205138370 cname:h6mgIOb+/A6A3i/W\r\na=ssrc:1205138370 msid:60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehq 60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehqv0\r\na=ssrc:1205138370 mslabel:60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehq\r\na=ssrc:1205138370 label:60c9wiCAirJ7BM3aohqS84qC5GnBsJs0vehqv0\r\n","type":"answer"} main.js:226
Set session description success. main.js:311
C->S: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:3362589025 1 udp 2113937151 192.168.5.69 38440 typ host generation 0\r\n"} main.js:226
C->S: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:3362589025 1 udp 2113937151 192.168.5.69 38440 typ host generation 0\r\n"} main.js:226
C->S: {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:2263807377 1 tcp 1509957375 192.168.5.69 0 typ host generation 0\r\n"} main.js:226
C->S: {"type":"candidate","label":1,"id":"video","candidate":"a=candidate:2263807377 1 tcp 1509957375 192.168.5.69 0 typ host generation 0\r\n"} main.js:226
S->C: {"id":"audio","type":"candidate","candidate":"a=candidate:312900489 1 udp 2113937151 192.168.5.162 37735 typ host generation 0\r\n","label":0} main.js:262
S->C: {"id":"audio","type":"candidate","candidate":"a=candidate:312900489 2 udp 2113937151 192.168.5.162 37735 typ host generation 0\r\n","label":0} main.js:262
S->C: {"id":"video","type":"candidate","candidate":"a=candidate:312900489 1 udp 2113937151 192.168.5.162 37735 typ host generation 0\r\n","label":1} main.js:262
S->C: {"id":"video","type":"candidate","candidate":"a=candidate:312900489 2 udp 2113937151 192.168.5.162 37735 typ host generation 0\r\n","label":1} main.js:262
S->C: {"id":"audio","type":"candidate","candidate":"a=candidate:1545963385 1 tcp 1509957375 192.168.5.162 36296 typ host generation 0\r\n","label":0} main.js:262
S->C: {"id":"audio","type":"candidate","candidate":"a=candidate:1545963385 2 tcp 1509957375 192.168.5.162 36296 typ host generation 0\r\n","label":0} main.js:262
S->C: {"id":"video","type":"candidate","candidate":"a=candidate:1545963385 1 tcp 1509957375 192.168.5.162 36296 typ host generation 0\r\n","label":1} main.js:262
S->C: {"id":"video","type":"candidate","candidate":"a=candidate:1545963385 2 tcp 1509957375 192.168.5.162 36296 typ host generation 0\r\n","label":1} main.js:262
S->C: {"id":"audio","type":"candidate","candidate":"a=candidate:2481880381 1 udp 1845501695 122.179.175.158 37735 typ srflx raddr 192.168.5.162 rport 37735 generation 0\r\n","label":0} main.js:262
S->C: {"id":"audio","type":"candidate","candidate":"a=candidate:2481880381 2 udp 1845501695 122.179.175.158 37735 typ srflx raddr 192.168.5.162 rport 37735 generation 0\r\n","label":0} main.js:262
S->C: {"id":"video","type":"candidate","candidate":"a=candidate:2481880381 1 udp 1845501695 122.179.175.158 37735 typ srflx raddr 192.168.5.162 rport 37735 generation 0\r\n","label":1} main.js:262
S->C: {"id":"video","type":"candidate","candidate":"a=candidate:2481880381 2 udp 1845501695 122.179.175.158 37735 typ srflx raddr 192.168.5.162 rport 37735 generation 0\r\n","label":1} main.js:262
End of candidates.
When I run AppRtcDemo on android after doing above changes local camera preview is started at right-top corner and message prompt "waiting for ICEcandidates" then nothing happens.
I have spent almost a month,Now please someone give me a break through.
Thanks in Advance.
I do following changes to ApprtcDemo (web) to work with my Turn server
1) apprtc.py
replace
with Point to my turn server turn_url = 'http://192.168.5.85:3478/?service=turn&username=biraj'
turn_url = 'https://computeengineondemand.appspot.com/' turn_url = turn_url + 'turn?' + 'username=' + user + '&key=4080218913'
2) index.html
replace
var pcConfig = {{ pc_config|safe }};
with
var pcConfig = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}, {"url":"turn:bi...@192.168.5.85:3479", "credential":"0x5b04123c3eec4cf0be64ab909bb2ff5b"}]};
it's a common setting on some routers, for example, that wired & wireless devices can't see each other
/*
* libjingle
* Copyright 2013, Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.appspot.apprtc;
import java.io.InputStream;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.util.Log;
import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* Java-land version of Google AppEngine's JavaScript Channel API:
* https://developers.google.com/appengine/docs/python/channel/javascript
*
* Requires a hosted HTML page that opens the desired channel and dispatches JS
* on{Open,Message,Close,Error}() events to a global object named
* "androidMessageHandler".
*/
public class GAEChannelClient {
private static final String TAG = "GAEChannelClient";
private WebView webView;
private final ProxyingMessageHandler proxyingMessageHandler;
/**
* Callback interface for messages delivered on the Google AppEngine
* channel.
*
* Methods are guaranteed to be invoked on the UI thread of |activity|
* passed to GAEChannelClient's constructor.
*/
public interface MessageHandler {
public void onOpen();
public void onMessage(String data);
public void onClose();
public void onError(int code, String description);
}
/** Asynchronously open an AppEngine channel. */
@SuppressLint("SetJavaScriptEnabled")
public GAEChannelClient(Activity activity, String token, MessageHandler handler) {
webView = new WebView(activity);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setAllowFileAccessFromFileURLs(true); // Maybe you
// don't
// need this
// rule
webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
webView.setWebChromeClient(new WebChromeClient() { // Purely for
// debugging.
public boolean onConsoleMessage(ConsoleMessage msg) {
Log.d(TAG, "console: " + msg.message() + " at " + msg.sourceId() + ":" + msg.lineNumber());
return false;
}
});
webView.setWebViewClient(new WebViewClient() { // Purely for debugging.
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.e(TAG, "JS error: " + errorCode + " in " + failingUrl + ", desc: " + description);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
System.out.println("HI");
return super.shouldOverrideUrlLoading(view, url);
}
});
proxyingMessageHandler = new ProxyingMessageHandler(activity, handler, token);
webView.addJavascriptInterface(proxyingMessageHandler, "androidMessageHandler");
// webView.loadUrl("file:///android_asset/channel.html");
try {
InputStream is = activity.getAssets().open("channel.html");
StringBuilder builder = new StringBuilder();
byte[] buffer = new byte[1024];
while (is.read(buffer) != -1) {
builder.append(new String(buffer));
}
is.close();
String str = builder.toString();
webView.loadDataWithBaseURL("http://192.168.5.86:8080", str, "text/html", "utf-8", null);
} catch (Exception e) {
e.printStackTrace();
}
}
/** Close the connection to the AppEngine channel. */
public void close() {
if (webView == null) {
return;
}
proxyingMessageHandler.disconnect();
webView.removeJavascriptInterface("androidMessageHandler");
webView.loadUrl("about:blank");
webView = null;
}
// Helper class for proxying callbacks from the Java<->JS interaction
// (private, background) thread to the Activity's UI thread.
private static class ProxyingMessageHandler {
private final Activity activity;
private final MessageHandler handler;
private final boolean[] disconnected = { false };
private final String token;
public ProxyingMessageHandler(Activity activity, MessageHandler handler, String token) {
this.activity = activity;
this.handler = handler;
this.token = token;
}
public void disconnect() {
disconnected[0] = true;
}
private boolean disconnected() {
return disconnected[0];
}
@JavascriptInterface
public String getToken() {
return token;
}
@JavascriptInterface
public void onOpen() {
System.out.println("GAEClient : Open" );
activity.runOnUiThread(new Runnable() {
public void run() {
if (!disconnected()) {
handler.onOpen();
}
}
});
}
@JavascriptInterface
public void onMessage(final String data) {
System.out.println("GAEClient : Message : " +data );
activity.runOnUiThread(new Runnable() {
public void run() {
if (!disconnected()) {
handler.onMessage(data);
}
}
});
}
@JavascriptInterface
public void onClose() {
System.out.println("GAEClient : Close" );
activity.runOnUiThread(new Runnable() {
public void run() {
if (!disconnected()) {
handler.onClose();
}
}
});
}
@JavascriptInterface
public void onError(final int code, final String description) {
System.out.println("GAEClient : Erroe : " + description);
activity.runOnUiThread(new Runnable() {
public void run() {
if (!disconnected()) {
handler.onError(code, description);
}
}
});
}
}
}
webView.getSettings().setAllowFileAccessFromFileURLs(true);webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
webView.loadUrl("file:///android_asset/channel.html");
try {InputStream is = activity.getAssets().open("channel.html");StringBuilder builder = new StringBuilder();byte[] buffer = new byte[1024];while (is.read(buffer) != -1) {builder.append(new String(buffer));}is.close();String str = builder.toString();webView.loadDataWithBaseURL("http://192.168.5.86:8080", str, "text/html", "utf-8", null);} catch (Exception e) {e.printStackTrace();}
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
...
System.out.println("GAEClient : Close" <span sty
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
...
System.<span style="co
The appEngine is that for the signaling?
I reverted my changes for the AppRTCDemoActivity android app and I see where the turn server is been set. I change it to point to my local turn server. Here are the outputs I see in the turn server logs. I want to force the apps to use my turn server for testing. There's always an empty user that tries to connect when the apps are connecting and it shows 401.
No, I don't know how to configure your turn server. I recommend you try on a support list or forum for that server.
--
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
...