WebRTC - ApprtcDemo with local server does not work with Android native to PC browser

前端 未结 1 1690
逝去的感伤
逝去的感伤 2021-01-16 15:44

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 cl

相关标签:
1条回答
  • 2021-01-16 15:59

    After a lot of discussion, trial, error and logging we come tho these answers to fix the problems:

    1. Do not load channel.html from the internal assets folder. Then the url's don't match up anymore. (It is trying to post a message to the server at 'file://'+'/_ah/channel/jsapi', instead of 'http://server_adress:port'+'/_ah/channel/jsapi')
    2. After fixing that there was a problem with double slashes. appRTCSignalingParameters.gaeBaseHref contained a slash on the end, but appRTCSignalingParameters.postMessageUrl did that on the beginning so the program tried to post to server_adress:port//message which is incorrect. Simply removing the / from appRTCSignalingParameters.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:

    // Caller is always ready to create peerConnection.
    signalingReady = initiator;
    

    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 from onChannelMessage, as right on line 312 it should call maybeStart(). 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).

    0 讨论(0)
提交回复
热议问题