我试图创建一对一视频通话应用,我希望opentok是正确的方法。
我曾尝试在github中执行步骤到步骤之后运行一个简单的helloworld opentok应用程序,但我已经阻止了faq疑难解答指南中描述的四个错误。 我只更改了Build Active Architecture'没有,我从有效架构中删除了armv7s和arm64。 我在index.js中插入了我的id,密钥和令牌,但问题并没有改变...... 我认为解决方案相对简单但我不知道... 这是我的代码index.js
var apiKey = "xxx";
var sid = "xxx";
var token = "xxx";
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
// Getting OpenTokRTC's room's credentials.
// To use your own room in opentokrtc, change cordova to room of your choice
// -> ie: https://opentokrtc.com/myroom.json
// To use your own credentials
// replace data.apiKey, data.sid, and data.token with your own
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET", "https://opentokrtc.com/test.json", false);
xmlhttp.send();
var data = JSON.parse( xmlhttp.response );
// Very simple OpenTok Code for group video chat
var publisher = TB.initPublisher(apiKey,'myPublisherDiv');
var session = TB.initSession( apiKey, sid );
session.on({
'streamCreated': function( event ){
var div = document.createElement('div');
div.setAttribute('id', 'stream' + event.stream.streamId);
document.body.appendChild(div);
session.subscribe( event.stream, div.id, {subscribeToAudio: false} );
}
});
session.connect(token, function(){
session.publish( publisher );
});
},
// Update DOM on a Received Event
receivedEvent: function(id) {
}
};
我还在https://opentokrtc.com/创建了一个测试聊天页面,并在javascript文件中插入test.json但没有任何变化......
我真的想订阅一个计划并构建这个应用程序。 提前致谢
答案 0 :(得分:0)
目前没有iOS模拟器支持,因为OpenTok依赖于视频流的硬件编码/解码,需要访问摄像头。链接器错误可能是由于尝试部署到模拟器引起的,如果部署到设备则应该修复它。如果您仍然遇到问题,请同时发布链接器错误。