tokbox:Safari 上的订阅者超时错误

PSh*_*h_h 4 webrtc tokbox opentok

使用 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);

});

}
Run Code Online (Sandbox Code Playgroud)

  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)
Run Code Online (Sandbox Code Playgroud)

 

  上述所有错误仅在 Safari 浏览器上生成。 

Ada*_*man 6

您需要确保已在 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';
Run Code Online (Sandbox Code Playgroud)

您可能还想包含 getUserMedia 的 polyfill。更多详情请访问https://github.com/angular/zone.js/issues/948#issuecomment-357558384