【问题标题】:can't create phonertc client无法创建 phonertc 客户端
【发布时间】:2014-12-12 05:09:32
【问题描述】:

我找到了很好的项目on Github,但我无法全部了解。

我安装了一个信号服务器 (socket.io) 和一个转向服务器。我正在尝试为 IOS 制作一个应用程序,我正在使用如下代码:

<video height="300" id="localVideo"></video>
<video id="remotesVideos"></video>

<script type="text/javascript">
  document.addEventListener("deviceready", onDeviceReady, false);

  function onDeviceReady() {
    var phonertc = cordova.require('com.dooble.phonertc.PhoneRTC');
    var socket = io('http://mysait.com:3000');

    socket.on("connect", function() {
      socket.emit("join", "myroom");
      socket.on("message", function(message) {
        console.log("GOT MESSAGE:");
        message.payload.sdp = message.payload.sdp.replace(/(\r\n|\n|\r)/gm,"");

        // when a message is received from the signaling server,
        // notify the PhoneRTC plugin.
        phonertc.receiveMessage(message.payload);
      });
    });

    socket.on('connect',function() {
      alert ('is connect!');
    });

    phonertc.call({
      isInitator: true, // Caller or callee?
      turn: {
        host: 'turn:mysait.com:3478',
        username: 'test',
        password: 'test'
      },
      sendMessageCallback: function (data) {
        // PhoneRTC wants to send a message to your target, use
        // your signaling server here to send the message.
        console.log(data);
        socket.emit("message", data);
      },
      answerCallback: function () {
        alert('Callee answered!');
      },
      disconnectCallback: function () {
        alert('Call disconnected!');
      },
      video: {  // Remove this property if you don't want video chat
        localVideo: document.getElementById('localVideo'),
        remoteVideo: document.getElementById('remoteVideo')
      }
    });
  }
</script>

我在连接到服务器时收到警报,但我没有看到本地和远程视频。有人可以建议可能出了什么问题吗?你能把客户端的例子发给我吗,我找不到它here。

【问题讨论】:

    标签: javascript ios sockets cordova phonertc


    【解决方案1】:

    看起来这是一个非常旧的演示应用程序版本。正确的链接是: https://github.com/alongubkin/phonertc/tree/master/demo

    【讨论】:

    • 我需要将所有文件从 dir app 复制到我的 phonegap 项目吗?
    • 你应该只是重新克隆项目
    • 在新的 cordova 项目中喜欢这个 git clone MyTest github.com/alongubkin/phonertc.git?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-02
    • 2015-01-15
    • 2012-11-09
    相关资源
    最近更新 更多