本地服务器上的ApprtcDemo可在浏览器和Android之间运行,但不适用于iOS

时间:2014-02-13 14:15:06

标签: ios iphone objective-c webrtc

我正在尝试使用Webrtc在iPhone与浏览器之间使用ApprtcDemo进行调用

通过apprtc.appspot.com一切正常。但是当我在我的服务器上运行应用程序时,我能够在浏览器之间进行调用,并且在post的帮助下,我在浏览器和android之间进行了调用。

我无法在iPhone与浏览器之间进行通话......

对代码的更改:

在APPRTCAppClient.m中:

//NSString *path = [NSString stringWithFormat:@"https:%@", [url resourceSpecifier]];
  NSString *path = [NSString stringWithFormat:@"http:%@", [url resourceSpecifier]];

//NSString *url = [NSString stringWithFormat:@"%@/%@", self.baseURL, self.postMessageUrl];
  NSString *url = [NSString stringWithFormat:@"http://xxx.xx.x.xx:9090%@", self.postMessageUrl];

//[request addValue:@"https://apprtc.appspot.com" forHTTPHeaderField:@"origin"];
  [request addValue:@"http://xxx.xx.x.xx:9090" forHTTPHeaderField:@"origin"];

在APPRTCViewController.m中:

//NSString *url = [NSString stringWithFormat:@"apprtc://apprtc.appspot.com/?r=%@", room];
  NSString *url = [NSString stringWithFormat:@"apprtc://xxx.xx.x.xx:9090/?r=%@", room];

在ios_channel.html中:

//<script type="text/javascript" src="http://apprtc.appspot.com/_ah/channel/jsapi"></script>
  <script type="text/javascript" src="http://xxx.xx.x.xx:9090/_ah/channel/jsapi"></script>

当我尝试连接到我服务器上的房间(从iPhone)时,我收到了这条日志消息:

INFO     2014-02-11 07:11:53,911 apprtc.py:350] IN CLASS MainPage
INFO     2014-02-11 07:11:53,927 apprtc.py:246] IN CLASS Room: add_user
INFO     2014-02-11 07:11:53,941 apprtc.py:77] create_channel
INFO     2014-02-11 07:11:53,941 apprtc.py:163] Applying media constraints: {'vi
deo': True, 'audio': True}
INFO     2014-02-11 07:11:53,957 apprtc.py:517] User 80844306 added to room 85
INFO     2014-02-11 07:11:53,957 apprtc.py:518] Room 85 has state [80844306-Fals
e]
INFO     2014-02-11 07:11:53,973 module.py:612] default: "GET /?r=85 HTTP/1.1" 2
00 1744

此时应调用ConnectPage连接到房间,但没有任何反应......

当我尝试连接到我服务器上的房间(来自android)时,我收到了这条日志消息:

INFO     2014-02-11 07:11:53,911 apprtc.py:350] IN CLASS MainPage
INFO     2014-02-11 07:11:53,927 apprtc.py:246] IN CLASS Room: add_user
INFO     2014-02-11 07:11:53,941 apprtc.py:77] create_channel
INFO     2014-02-11 07:11:53,941 apprtc.py:163] Applying media constraints: {'vi
deo': True, 'audio': True}
INFO     2014-02-11 07:11:53,957 apprtc.py:517] User 59372716 added to room 51
INFO     2014-02-11 07:11:53,957 apprtc.py:518] Room 51 has state [59372716-Fals
e]
INFO     2014-02-11 07:11:53,973 module.py:612] default: "GET /?r=51 HTTP/1.1" 2
00 1744

INFO     2014-02-11 07:11:55,142 apprtc.py:306] IN CLASS ConnectPage
INFO     2014-02-11 07:11:55,158 apprtc.py:298] User 59372716 connected to room
51
INFO     2014-02-11 07:11:55,158 apprtc.py:299] Room 51 has state [59372716-True
]
INFO     2014-02-11 07:11:55,190 module.py:612] default: "POST /_ah/channel/conn
ected/ HTTP/1.1" 200 -

电话未通过,因为没有与房间的实际连接。

我还尝试使用wireshark查看客户端与服务器之间发送的内容,同时将android和iPhone作为客户端

来自iPhone:

1009    31.978872000    84.94.156.147   xxx.xx.x.xx HTTP    265 GET /?r=9 HTTP/1.1 
1022    32.088116000    xxx.xx.x.xx 84.94.156.147   HTTP    235 HTTP/1.1 200 OK      (text/html)
1093    32.788407000    84.94.156.147   xxx.xx.x.xx HTTP    343 GET /_ah/channel/jsapi HTTP/1.1 
1404    34.191465000    xxx.xx.x.xx 84.94.156.147   HTTP    769 HTTP/1.1 200 OK   (text/javascript)



GET /?r=9 HTTP/1.1 :

Hypertext Transfer Protocol
    GET /?r=9 HTTP/1.1\r\n
        Expert Info (Chat/Sequence): GET /?r=9 HTTP/1.1\r\n
            Message: GET /?r=9 HTTP/1.1\r\n
            Severity level: Chat
            Group: Sequence
        Request Method: GET
        Request URI: /?r=9
        Request Version: HTTP/1.1
    Host: xxx.xx.x.xx:9090\r\n
    Connection: keep-alive\r\n
    Accept-Encoding: gzip, deflate\r\n
    User-Agent: AppRTCDemo/1.0 CFNetwork/672.0.8 Darwin/14.0.0\r\n
    Accept-Language: he-il\r\n
    Accept: */*\r\n
    \r\n
    Full request URI: http://xxx.xx.x.xx:9090/?r=9
    HTTP request 1/1
    Response in frame: 1022



HTTP/1.1 200 OK  (text/html):

Hypertext Transfer Protocol
HTTP/1.1 200 OK\r\n
    Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n
        Message: HTTP/1.1 200 OK\r\n
        Severity level: Chat
        Group: Sequence
    Request Version: HTTP/1.1
    Status Code: 200
    Response Phrase: OK
content-type: text/html; charset=utf-8\r\n
cache-control: no-cache\r\n
Content-Length: 1705\r\n
    Content length: 1705
Server: Development/2.0\r\n
   Date: Thu, 13 Feb 2014 12:55:23 GMT\r\n
   \r\n
   HTTP response 1/1
  Line-based text data: text/html
   (here i have the index.html file filled with the content for each of the vars)


   GET /_ah/channel/jsapi HTTP/1.1 :

   Hypertext Transfer Protocol
       GET /_ah/channel/jsapi HTTP/1.1\r\n
           Expert Info (Chat/Sequence): GET /_ah/channel/jsapi HTTP/1.1\r\n
               Message: GET /_ah/channel/jsapi HTTP/1.1\r\n
               Severity level: Chat
               Group: Sequence
           Request Method: GET
           Request URI: /_ah/channel/jsapi
           Request Version: HTTP/1.1
       Host: xxx.xx.x.xx:9090\r\n
       Connection: keep-alive\r\n
       Accept-Encoding: gzip, deflate\r\n
       User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1    (KHTML, like Gecko) Mobile/11B554a\r\n
       Accept-Language: he-il\r\n
       Accept: */*\r\n
       \r\n
       Full request URI: http://xxx.xx.x.xx:9090/_ah/channel/jsapi
       HTTP request 1/1
       Response in frame: 1404



   HTTP/1.1 200 OK  (text/javascript):


   HTTP/1.1 200 OK  (text/html):

   Hypertext Transfer Protocol
       HTTP/1.1 200 OK\r\n
           Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n
               Message: HTTP/1.1 200 OK\r\n
               Severity level: Chat
               Group: Sequence
           Request Version: HTTP/1.1
           Status Code: 200
           Response Phrase: OK
       cache-control: no-cache\r\n
       content-type: text/javascript\r\n
       Content-Length: 238051\r\n
           Content length: 238051
       Server: Development/2.0\r\n
       Date: Thu, 13 Feb 2014 12:55:24 GMT\r\n
       \r\n
       HTTP response 1/1
   Line-based text data: text/html
       (here i have the jsapi file)

FROM android:

   2103 64.994817000    62.219.128.171  xxx.xx.x.xx HTTP    231 GET /?r=7 HTTP/1.1 
   2109 65.056073000    xxx.xx.x.xx 62.219.128.171  HTTP    225 HTTP/1.1 200 OK  (text/html)
   2329 68.436749000    62.219.128.171  xxx.xx.x.xx HTTP    499 GET /_ah/channel/jsapi    HTTP/1.1 
   2659 71.766089000    xxx.xx.x.xx 62.219.128.171  HTTP    869 HTTP/1.1 200 OK     (text/javascript)
   2723 72.548316000    62.219.128.171  xxx.xx.x.xx HTTP    582 GET /_ah/channel/dev?   command=connect&channel=52dc587e2a55f84d5a24d607e01265a6-channel-2672196958-1392299260-7/48366753    HTTP/1.1 
   2725 72.551059000    xxx.xx.x.xx 62.219.128.171  HTTP    67  HTTP/1.1 200 OK  (text/plain)
   2755 73.546369000    62.219.128.171  xxx.xx.x.xx HTTP    588 GET /_ah/channel/dev?   command=poll&channel=52dc587e2a55f84d5a24d607e01265a6-channel-2672196958-1392299260-   7/48366753&client=1 HTTP/1.1 
   2756 73.547829000    xxx.xx.x.xx 62.219.128.171  HTTP    191 HTTP/1.1 200 OK 



GET /?r=7 HTTP/1.1 :

Hypertext Transfer Protocol
    GET /?r=7 HTTP/1.1\r\n
        Expert Info (Chat/Sequence): GET /?r=7 HTTP/1.1\r\n
            Message: GET /?r=7 HTTP/1.1\r\n
            Severity level: Chat
            Group: Sequence
        Request Method: GET
        Request URI: /?r=7
        Request Version: HTTP/1.1
    User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.3; Nexus 4 Build/JWR66V)\r\n
    Host: xxx.xx.x.xx:9090\r\n
    Connection: keep-alive\r\n
    Accept-Encoding: gzip\r\n
    \r\n
    Full request URI: http://xxx.xx.x.xx:9090/?r=7
    HTTP request 1/1
    Response in frame: 2109



HTTP/1.1 200 OK  (text/html):

Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
        Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n
            Message: HTTP/1.1 200 OK\r\n
            Severity level: Chat
            Group: Sequence
        Request Version: HTTP/1.1
        Status Code: 200
        Response Phrase: OK
    content-type: text/html; charset=utf-8\r\n
    cache-control: no-cache\r\n
    Content-Length: 1695\r\n
        Content length: 1695
    Server: Development/2.0\r\n
    Date: Thu, 13 Feb 2014 13:17:39 GMT\r\n
    \r\n
    HTTP response 1/2
Line-based text data: text/html
    (here i have the index.html file filled with the content for each of the vars)


    GET /_ah/channel/jsapi HTTP/1.1 :

    Hypertext Transfer Protocol
        GET /_ah/channel/jsapi HTTP/1.1\r\n
            Expert Info (Chat/Sequence): GET /_ah/channel/jsapi HTTP/1.1\r\n
                Message: GET /_ah/channel/jsapi HTTP/1.1\r\n
                Severity level: Chat
                Group: Sequence
            Request Method: GET
            Request URI: /_ah/channel/jsapi
            Request Version: HTTP/1.1
        Host: xxx.xx.x.xx:9090\r\n
        Connection: keep-alive\r\n
        Referer: http://xxx.xx.x.xx:9090/\r\n
        Accept: */*\r\n
        X-Requested-With: org.appspot.apprtc\r\n
        User-Agent: Mozilla/5.0 (Linux; U; Android 4.3; he-il; Nexus 4 Build/JWR66V)         AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30\r\n
        Accept-Encoding: gzip, deflate\r\n
        Accept-Language: he-IL, en-US\r\n
        Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7\r\n
        \r\n
        Full request URI: http://xxx.xx.x.xx:9090/_ah/channel/jsapi
        HTTP request 1/8




HTTP/1.1 200 OK  (text/javascript):


HTTP/1.1 200 OK  (text/html):

Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
        Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n
            Message: HTTP/1.1 200 OK\r\n
            Severity level: Chat
            Group: Sequence
        Request Version: HTTP/1.1
        Status Code: 200
        Response Phrase: OK
    cache-control: no-cache\r\n
    content-type: text/javascript\r\n
    Content-Length: 238051\r\n
        Content length: 238051
    Server: Development/2.0\r\n
    Date: Thu, 13 Feb 2014 13:17:42 GMT\r\n
    \r\n
    HTTP response 1/8
Line-based text data: text/html
    (here i have the jsapi file)

任何人都可以帮助解决这个问题。 关于如何进行的任何想法都会很好。

提前致谢

2 个答案:

答案 0 :(得分:1)

我在WebRTC团队中,很可能iOS版本的AppRTCDemo(现在更名为AppRTCMobile)在您解释时并不起作用。如果这仍然是一个问题,请告诉我们。该应用程序最近已经完成了很多工作。

答案 1 :(得分:-1)

休会本教程

http://ninjanetic.com/how-to-get-started-with-webrtc-and-ios-without-wasting-10-hours-of-your-life/

在build_apprtc.sh中替换此行

export GYP_DEFINES =&#34; build_with_libjingle = 1 build_with_chromium = 0 libjingle_objc = 1 OS = ios target_arch = armv7&#34;

export GYP_DEFINES =&#34; OS = ios target_arch = arm64 target_subarch = arm64&#34;

它应该在iOS中完美运行,而且你应该提供你自己的转向服务器,并为bigQuery启用计费,让它与你自己的服务器URL一起运行。