I have ApprtcDemo from Android to Desktop not working, i have followed all the StackOVerflow links and Google discussion links none of them made it working yet, everybody claim that local setup worked for them but doing the same suggestion did not worked.
So please here you can find the completely source code how others did and i also did but still when Android device app starts i can only see selfview and it connects to Google Apps Engine but it never connects to the room for a audio/video session.
Can you please suggest and advise so that we can together make a reliable answer here about this issue? it took me 3 months and i could not make it work yet.
Step 1: go to https://code.google.com/p/test-apprtc-demo/source/browse/
Step 2: folder apprtc = javascript, python, webrtc, google app engine complete code folder android contain all the source code of android apprtcdemo
Step 3: please check those files which i modified
a) https://code.google.com/p/test-apprtc-demo/source/browse/android/assets/channel.html
here i have embedded the javascript where others were confusing about it
https://code.google.com/p/test-apprtc-demo/source/browse/apprtc/index.html
here i have changed the pcConfig variable with hardcoded turnserver details
here i have modified private PeerConnection.IceServer requestTurnServer(String url) private LinkedList iceServersFromPCConfigJSON( String pcConfig)
here i have modified roomInput.setText("http://notappspot.com.placeit.toyour.localhost/?r=");
here i have modified nothing webView.loadUrl("file:///android_asset/channel.html"); //<< no need to change cause we have channel.html file with javascript embedded check that file
Step 4: now the Apprtcdemo was build/release and ran in my Android phone , at the same time i was in my WebRTC server connected with Google Chrome latest version
Step 5: when Android and Google Chrome try to connect nothing happens Google chrome shows "waiting for someone to join...."
and on Android i have a Green screen and my own camera view on top right corner.
Please please kindly someone advise. so that i can make this interconnect i lost 3 month on this.
EDIT:
Step 1: start the local server for signaling to allow Mobile and Google Chrome do shake hand:
$ python dev_appserver.py --host 0.0.0.0 --port 9999 /var/tmp/webrtc-read-only/samples/js/apprtc
WARNING 2014-05-30 08:07:49,416 api_server.py:378] Could not initialize images API; you are likely missing the Python "PIL" module.
WARNING 2014-05-30 08:07:49,420 simple_search_stub.py:1072] Could not read search indexes from /var/folders/h3/jgrrj7fd35vf0v77xjbhryph0000gn/T/appengine.apprtc.sun/search_indexes
INFO 2014-05-30 08:07:49,424 api_server.py:171] Starting API server at: http://localhost:52919
INFO 2014-05-30 08:07:49,427 dispatcher.py:182] Starting module "default" running at: http://0.0.0.0:9999
INFO 2014-05-30 08:07:49,434 admin_server.py:117] Starting admin server at: http://localhost:8000
Step 2: launch PC Google Chrome to connect the server
<<<<========= PC Google Chrome Browser connnected and waiting for someone to join ====>>>
INFO 2014-05-30 08:09:34,059 apprtc.py:147] Applying media constraints: {'video': True, 'audio': True}
INFO 2014-05-30 08:09:34,070 apprtc.py:473] User 24910306 added to room 12344
INFO 2014-05-30 08:09:34,070 apprtc.py:474] Room 12344 has state [24910306-False]
INFO 2014-05-30 08:09:34,075 module.py:639] default: "GET /?r=12344 HTTP/1.1" 200 1646
INFO 2014-05-30 08:09:34,123 module.py:639] default: "GET /js/adapter.js HTTP/1.1" 304 -
INFO 2014-05-30 08:09:34,123 module.py:639] default: "GET /css/main.css HTTP/1.1" 304 -
INFO 2014-05-30 08:09:34,124 module.py:639] default: "GET /js/main.js HTTP/1.1" 304 -
INFO 2014-05-30 08:09:34,289 apprtc.py:268] User 24910306 connected to room 12344
INFO 2014-05-30 08:09:34,290 apprtc.py:269] Room 12344 has state [24910306-True]
INFO 2014-05-30 08:09:34,366 module.py:639] default: "POST /_ah/channel/connected/ HTTP/1.1" 200 -
INFO 2014-05-30 08:09:34,379 module.py:639] default: "GET /favicon.ico HTTP/1.1" 404 154
At that time Google chrome browser log:
This appears to be Chrome
Initializing; room=12344.
Opening channel.
Requested access to local media with mediaConstraints:
'{"video":true,"audio":true}'
Channel opened.
User has granted access to local media.
Step 3: Open Android Apps
<<<<======== Now opening Android phone AppRTCDEmo executed to connect with above Google Chrome, but nothing more happens ======>>>
INFO 2014-05-30 08:11:54,693 apprtc.py:147] Applying media constraints: {'video': True, 'audio': True}
INFO 2014-05-30 08:11:54,693 apprtc.py:473] User 28334488 added to room 12344
INFO 2014-05-30 08:11:54,693 apprtc.py:474] Room 12344 has state [24910306-True, 28334488-False]
INFO 2014-05-30 08:11:54,698 module.py:639] default: "GET /?r=12344 HTTP/1.1" 200 1652
Step 4: nothing happens
Now nothing happens..... and please see mobile and desktop screen shot, both are doing nothing like its waiting for something....
After a lot of discussion, trial, error and logging we come tho these answers to fix the problems:
'file://'+'/_ah/channel/jsapi'
, instead of'http://server_adress:port'+'/_ah/channel/jsapi'
)appRTCSignalingParameters.gaeBaseHref
contained a slash on the end, butappRTCSignalingParameters.postMessageUrl
did that on the beginning so the program tried to post toserver_adress:port//message
which is incorrect. Simply removing the / fromappRTCSignalingParameters.postMessageUrl
fixed this.Old answer:
Thanks for the logging. Now we know what goes wrong. The if doesn't trigger because
signalingReady == 0
. The reason it is zero is because of something I found on line 49:I have no idea why this is there, and what it does.
Also, the only way to make it true happens on line 311, which is inside the function
onChannelMessage
. There is no log from that function, and also the console.trace doesn't show anything fromonChannelMessage
, as right on line 312 it should callmaybeStart()
. So to temporary avoid it won't work, because there is no signalling done.So what I think would solve the solution is to set initiator to 1 somewhere. You can do this for instance in the function that creates a new room, so the script directly knows that you are the initiator and not joining anyone.
I hope this solves your problem, and please keep me updated on further results and problems.
(As this is a demo from the site, I also suggest you to try and understand how an RTC connection is established, and write everything from the ground up. This will make your knowledge a lot better and debugging will be much easier, as it is your own code which you understand).