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

tokbox : Subscriber time out error on Safari

使用 opentok.js v2,视频频道可以在 Chrome 和 Firefox 上正常工作。使用的opentok版本来自这个link:https://static.opentok.com/v2/js/opentok.min.js

但不适用于 Safari 11.0.3。 在会话的流创建事件中,它会生成以下错误消息 "The stream was unable to connect due to a network error. Make sure your connection isnt blocked by a firewall" 发布者已成功发布,即 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