tokbox:Safari

时间:2018-02-07 01:19:25

标签: webrtc opentok tokbox

使用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浏览器上生成。

1 个答案:

答案 0 :(得分:2)

您需要确保在OpenTok帐户门户中创建了Safari项目。更多详情请见https://tokbox.com/developer/sdks/js/safari/

看起来你正在使用polyfills.js文件。如果这是来自Angular的polyfill包含zone.js,那么您需要在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

相关问题