QuickBlox 视频聊天演示 Web 示例:"this.socket is undefined" 调用开始调用后
QuickBlox Video Chat Demo Web Sample: "this.socket is undefined" after calling start call
我在 QuickBlox 视频聊天演示示例中收到 "this.socket is undefined" 错误。当我 运行 在本地(从本地文件系统)它工作正常,但如果我将它集成到 ASP.NET MVC 应用程序,该应用程序 运行 在本地 IIS Espress 上运行(Visual Studio 2015 ) 当我点击 "Start Call" 并接受分享 audio/video deviec media:
时,Firefox 控制台 window 出现以下错误
this.socket is undefined QB.js:8111:0
[QBWebRTC]: _dialingCallback, answerTimeInterval: 5000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 10000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 15000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 20000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 25000 QB.js:1620:32
TypeError: this.socket is undefined
这里"QB.JS"是QuickBlox JS SDK的未压缩版本。我做到了,这样可以知道JS SDK中的哪个代码块抛出错误
QuickBlox 文档说,出于安全原因,它应该 运行 通过 HTTPS,因此我也通过启用 SSL 并附加自签名证书来尝试,但运气不佳
您能否在这里说明问题出在哪里以及为什么我看到如此奇怪的未记录行为。
注意:这是我从 GitHib 下载的相同示例(遵循 QuickBlox 文档页面),除了配置文件包含我自己的 "AppId/AuthKey/AuthSecrect and few demo users"
如果您遇到同样的情况,请确保
您还没有通过说 QB.Init()
启动 QB 框架
您尚未打开聊天会话。我的观察:如果
您通过说 QB.createSession()
打开了一个 XMPP
聊天会话
并且您正在尝试创建一个视频 webrtc
会话,它提供了这个
奇怪的错误。
以防万一,您出于某种目的需要创建一个会话,然后在打开视频会话之前销毁它,例如:
QB.createSession(function(res, err)
{
if(err)
console.log(JSON.Stringify(err));
else
//do your stuff here and once done
QB.Destroysession(function(){
}
});
});
现在您可以开始创建视频会话了,它会工作得很好。您可以在此处查看实际 GitHub post https://github.com/QuickBlox/quickblox-javascript-sdk/issues/125
将您的视频通话功能移到 QB.createSession 功能之外。
var occupantIds = [];
QB.createSession(function(err,result){
if (result) {
// Login, then chat.connect, then do chat stuff here, like get your occupant id's
}else () {
console.log(err);
}
});
// 现在进行视频通话
QB.webrtc.createNewSession(occupantIds, QB.webrtc.CallType.VIDEO);
session.getUserMedia($scope.localMediaParams, function(err, stream) {
if (err){
console.log(err);
}else{
console.log('Now Make the call);
session.call({}, function(error) {
console.log(error);
});
}
});
我在 QuickBlox 视频聊天演示示例中收到 "this.socket is undefined" 错误。当我 运行 在本地(从本地文件系统)它工作正常,但如果我将它集成到 ASP.NET MVC 应用程序,该应用程序 运行 在本地 IIS Espress 上运行(Visual Studio 2015 ) 当我点击 "Start Call" 并接受分享 audio/video deviec media:
时,Firefox 控制台 window 出现以下错误this.socket is undefined QB.js:8111:0
[QBWebRTC]: _dialingCallback, answerTimeInterval: 5000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 10000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 15000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 20000 QB.js:1620:32
TypeError: this.socket is undefined
QB.js:8111:175
[QBWebRTC]: _dialingCallback, answerTimeInterval: 25000 QB.js:1620:32
TypeError: this.socket is undefined
这里"QB.JS"是QuickBlox JS SDK的未压缩版本。我做到了,这样可以知道JS SDK中的哪个代码块抛出错误
QuickBlox 文档说,出于安全原因,它应该 运行 通过 HTTPS,因此我也通过启用 SSL 并附加自签名证书来尝试,但运气不佳
您能否在这里说明问题出在哪里以及为什么我看到如此奇怪的未记录行为。
注意:这是我从 GitHib 下载的相同示例(遵循 QuickBlox 文档页面),除了配置文件包含我自己的 "AppId/AuthKey/AuthSecrect and few demo users"
如果您遇到同样的情况,请确保
您还没有通过说 QB.Init()
您尚未打开聊天会话。我的观察:如果
您通过说 QB.createSession()
打开了一个 XMPP
聊天会话
并且您正在尝试创建一个视频 webrtc
会话,它提供了这个
奇怪的错误。
以防万一,您出于某种目的需要创建一个会话,然后在打开视频会话之前销毁它,例如:
QB.createSession(function(res, err)
{
if(err)
console.log(JSON.Stringify(err));
else
//do your stuff here and once done
QB.Destroysession(function(){
}
});
});
现在您可以开始创建视频会话了,它会工作得很好。您可以在此处查看实际 GitHub post https://github.com/QuickBlox/quickblox-javascript-sdk/issues/125
将您的视频通话功能移到 QB.createSession 功能之外。
var occupantIds = [];
QB.createSession(function(err,result){
if (result) {
// Login, then chat.connect, then do chat stuff here, like get your occupant id's
}else () {
console.log(err);
}
});
// 现在进行视频通话
QB.webrtc.createNewSession(occupantIds, QB.webrtc.CallType.VIDEO);
session.getUserMedia($scope.localMediaParams, function(err, stream) {
if (err){
console.log(err);
}else{
console.log('Now Make the call);
session.call({}, function(error) {
console.log(error);
});
}
});