0
我發現很好的項目on Github,但我無法理解它的全部。無法創建phonertc客戶端
我安裝了一個信令服務器(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。
我需要將目錄應用程序的所有文件複製到我的phonegap項目? – user4150916 2014-10-16 18:43:24
你應該重新克隆項目 – 2014-10-16 18:46:31
像這個git clone MyTest https://github.com/alongubkin/phonertc.git在新的cordova項目中? – user4150916 2014-10-16 19:43:15