使用opentok.js v2,该视频频道可与Chrome和Firefox正常运行。使用的opentok版本来自以下链接:https ://static.opentok.com/v2/js/opentok.min.js
但不适用于Safari 11.0.3。在会话的流创建事件上,它将生成以下错误消息“由于网络错误,流无法连接。请确保您的连接未被防火墙阻止。”发布者已成功发布,即session.publish(..)正常运行。
以下代码用于进行视频通话:
this.session = OT.initSession(this.apiKey,this.sessionId);
this.session.on({
streamCreated: (event) => {
this.session.subscribe(event.stream, 'subscriber');
},
streamDestroyed: (event) => {
console.log(`Stream ${event.stream.name} ended because ${event.reason}`);
}
});
this.session.connect(this.token, () => {
this.publisher=OT.initPublisher('publisher');
this.session.publish(this.publisher);
});
}
opentok.js生成的控制台中的其他异常如下:
[Error] OT.exception :: title: undefined (1554) msg: OT.Subscriber PeerConnection Error: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
_exceptionHandler (vendor.js:150924)
handleJsException (vendor.js:151002)
onPeerConnectionFailure (vendor.js:162673)
(anonymous function) (vendor.js:162414)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
[Error] OT_ICE_WORKFLOW_FAILED: ICEWorkflow: Subscriber PeerConnection with connection (not found) failed: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
dispatchOTError (vendor.js:159161)
(anonymous function) (vendor.js:160080)
handleThisOnce (vendor.js:137437)
(anonymous function) (vendor.js:137675)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
[Error] OT.exception :: title: undefined (1554) msg: ICEWorkflow: Subscriber PeerConnection with connection (not found) failed: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
_exceptionHandler (vendor.js:150924)
handleJsException (vendor.js:151002)
dispatchOTError (vendor.js:159163)
(anonymous function) (vendor.js:160080)
handleThisOnce (vendor.js:137437)
(anonymous function) (vendor.js:137675)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
以上所有错误仅在Safari浏览器上生成。
您需要确保已在OpenTok帐户门户中创建了Safari项目。有关更多详细信息,请访问https://tokbox.com/developer/sdks/js/safari/
看起来您正在使用polyfills.js文件。如果那是来自Angular的包含zone.js的polyfill,则您需要在polyfills.js文件中包含针对RTCPeerConnections'zone.js / dist / webapis-rtc-peer-connection'的修复程序。
import 'zone.js/dist/webapis-rtc-peer-connection';
您可能还希望为getUserMedia包括polyfill。有关更多详细信息,请参见https://github.com/angular/zone.js/issues/948#issuecomment-357558384
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句