Webrtc vline为被调用方添加远程流失败
我正在尝试将您的api用于具有导入用户的自定义应用程序。 一切正常(auth_令牌、登录、调用启动),但是当被调用方应该得到响应并添加remotestream时,什么都没有发生。控制台中不会显示任何错误。 如果有人看一下代码并告诉我缺少什么,我将不胜感激。 我在尝试了vline演示,它在两台计算机之间使用相同的浏览器和条件。在我的应用程序中,它是http,但我也尝试了https,同样的问题也出现了。这是我用来测试api的一些简化代码Webrtc vline为被调用方添加远程流失败,webrtc,vline,Webrtc,Vline,我正在尝试将您的api用于具有导入用户的自定义应用程序。 一切正常(auth_令牌、登录、调用启动),但是当被调用方应该得到响应并添加remotestream时,什么都没有发生。控制台中不会显示任何错误。 如果有人看一下代码并告诉我缺少什么,我将不胜感激。 我在尝试了vline演示,它在两台计算机之间使用相同的浏览器和条件。在我的应用程序中,它是http,但我也尝试了https,同样的问题也出现了。这是我用来测试api的一些简化代码 var Streams = []; var Vsession
var Streams = [];
var Vsession = null;
var Vline = (function(){
var Client;
var authToken;
var service_id = 'freeofcinema';
var profile = null;
var Person;
var Calls = [];
var onMessage = function(event){
//alert('message');
var msg = event.message, sender = msg.getSender();
console.log(sender.getDisplayName() +'sais: '+ msg.getBody());
console.log(event);
}
var onMediaSession = function(event){
console.log(event);
var mediaSession = event.target;
InitSession(mediaSession);
}
function Call(mediaSession) {
mediaSession.
on('change', alert_info);
}
function alert_info(b){
console.log(b);
}
function InitSession(mediaSession){
mediaSession.on('mediaSession:addRemoteStream', function(event) {
alert('addRemoteStream');
});
mediaSession.on('mediaSession:addLocalStream', function(event) {
alert('addLocalStream');
});
mediaSession.on('mediaSession:removeLocalStream mediaSession:removeRemoteStream', function(event) {
console.log('removedStream');
});
Calls.push(new Call(mediaSession));
}
return {
init : function(){
if(profile){
return;
}
profile = {
"displayName" : //some getusrname function...
};
$.post('vtoken.php',{//get auth token
id : Comm.Voip_user().id
},function(data){
authToken = data;
Client = vline.Client.create({
"serviceId": service_id,
"ui" : true
});
Client.on('recv:im', onMessage , this);
Client.on('add:mediaSession', onMediaSession, this);
Client.on('login', function(e) {
Vsession = e.target;
//alert('loged in');
});
Client.login(service_id, profile, authToken);
});
},
getPerson : function(id){//id of user to call
if(Vsession){
Vsession.getPerson(id).
done(function(person){
Person = person;
Vsession.startMedia(id);
});
}
}
}
}());
谢谢你的回复
我尝试了应用程序中的一个用户和应用程序中的另一个用户,但出现了相同的问题。另外,调用(处于挂起状态)会在短时间后终止。当传递ui:true时创建客户端时,您不必自己处理媒体会话。只需注释行Client.on('add:mediaSession',onMediaSession,this);而且它应该会起作用 Client.on('add:mediaSession', onMediaSession, this);