实现WebRTC - ApprtcDemo与本地服务器不与Android原生PC浏览器中运行不与、器中、服务器、ApprtcDemo

2023-09-06 22:51:25 作者:哥從вμ輕易⑥淚

我有ApprtcDemo从机器人到台式机不能正常工作,我按照所有的计算器链接和谷歌的讨论链接他们没有做它的工作还没有,每个人都声称本地设置为他们工作,但做同样的建议并没有奏效。

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.

所以,请在这里你可以找到完全源$ C ​​$ C别人怎么做,我也没有,但仍然在Android设备上的应用程序启动时,我只能看到selfview并将其连接到谷歌应用程序引擎,但它从来没有连接到房间一个音频/视频会议。

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.

您可以请建议和指导,使我们可以一起做一个可靠的答案在这里对这个问题的?我花了3个月,我不能使它发挥作用呢。

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.

第1步:去   的https://$c$c.google.com/ P /测试apprtc-演示/源/浏览/

步骤2:文件夹apprtc = javascript中,蟒蛇,实现WebRTC,谷歌应用程序引擎   完整的code文件夹中包含的Andr​​oid机器人的所有源$ C ​​$ C   apprtcdemo

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

一)   的https://$c$c.google.com/p/test-apprtc-demo/source/browse/android/assets/channel.html

在这里,我有嵌入其中,其他人混淆它的JavaScript

here i have embedded the javascript where others were confusing about it

https://开头code.google.com / P /测试apprtc-演示/源/浏览/ apprtc / index.html的

在这里,我已经改变了pcConfig变量硬codeD turnserver细节

here i have changed the pcConfig variable with hardcoded turnserver details

二)   https://$c$c.google.com/p/test-apprtc-demo/source/browse/android/src/org/appspot/apprtc/AppRTCClient.java

在这里,我已经修改了私人PeerConnection.IceServer requestTurnServer(字符串URL)的私人     链表iceServersFromPCConfigJSON(           字符串pcConfig)

计算机网络学习笔记 4

here i have modified private PeerConnection.IceServer requestTurnServer(String url) private LinkedList iceServersFromPCConfigJSON( String pcConfig)

C)   https://$c$c.google.com/p/test-apprtc-demo/source/browse/android/src/org/appspot/apprtc/AppRTCDemoActivity.java

在这里,我已经修改         roomInput.setText( HTTP:?//notappspot.com.placeit.toyour.localhost/ř = 的);

here i have modified roomInput.setText("http://notappspot.com.placeit.toyour.localhost/?r=");

D)   https://$c$c.google.com/p/test-apprtc-demo/source/browse/android/src/org/appspot/apprtc/GAEChannelClient.java

在这里,我已经修改了什么webView.loadUrl(文件:///android_asset/channel.html); //<<无需     改变的原因,我们有channel.html文件中嵌入JavaScript检查     该文件

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

第四步:现在Apprtcdemo是建立/释放,跑在我的Andr​​oid   电话,同时我在我与连接实现WebRTC服务器   谷歌浏览器最新版本

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

第五步:当Android和谷歌浏览器尝试连接没有任何反应   谷歌Chrome浏览器显示等待某人加入...。

Step 5: when Android and Google Chrome try to connect nothing happens Google chrome shows "waiting for someone to join...."

和Android上我有一个绿色的屏幕,并在上面我自己的相机视图   右上角。

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.

编辑:的

第1步:启动本地服务器的信号,使移动和谷歌Chrome浏览器做握手:

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

第2步:启动电脑谷歌浏览器连接的服务器

Step 2: launch PC Google Chrome to connect the server

&LT;&LT;&LT;&LT; ========= PC谷歌Chrome浏览器connnected,等待某人加入==== >>>

<<<<========= 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

当时谷歌Chrome浏览器的日志:

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.

第三步:打开Android应用

Step 3: Open Android Apps

&LT;&LT;&LT;&LT; ========现在开放的Andr​​oid手机AppRTCDEmo执行与上述谷歌浏览器连接,但仅此而已发生== >>>

<<<<======== 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

步骤4:什么都不会发生。

Step 4: nothing happens

现在什么也没有发生.....并请参阅移动和桌面截屏,无论在做什么样的等待着什么......

Now nothing happens..... and please see mobile and desktop screen shot, both are doing nothing like its waiting for something....

推荐答案

经过了大量的讨论,审判,错误和记录我们来寿这些答案来解决这个问题:

请不要从内部资产的文件夹加载channel.html。然后URL的不匹配了。 (它正试图发布消息到服务器文件://+/ _啊/渠道/ JSAPI而不是, HTTP:// server_adress:口'+'/ _啊/渠道/ JSAPI) 在固定,有双斜线的问题之后。 appRTCSignalingParameters.gaeBaseHref 包含在最终斜线,但 appRTCSignalingParameters.postMessageUrl 这样做,就开始这样的程序试图张贴到 server_adress:端口//消息这是不正确。只需从 appRTCSignalingParameters.postMessageUrl 删除/固定这一点。 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') 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.

旧的回答: 感谢您的日志记录。现在我们知道了什么​​不顺心。如果将不会触发,因为 signalingReady == 0 。它之所以是零,因为这是我发现的第49行:

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.

此外,使其真正的唯一途径发生在管311,这是在函数内部 onChannelMessage 。有没有日志从功能,并且还console.trace没有显示从 onChannelMessage 任何事情,因为右行312应该叫 maybeStart ()。因此,为了避免临时它不会工作,因为没有信号完成的。

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.

所以,我认为会解决的解决办法是将引发1的地方。你可以这样做,例如在创建新房间的功能,所以脚本直接知道你是发起者和不加入任何人。

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.

(由于这是从网站的演示,我也建议你尝试和了解一个RTC连接是如何建立的,并写了从地上爬了起来,这会让你的知识好了很多,调试将会容易得多,因为这是你自己的code,你懂的)。

(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).