TokBox重新发布问题--取消发布后尝试发布时出现错误。

问题描述 投票:0回答:1

我正试图创建一个一对一的视频流Ionic应用程序,在应用程序中,我有一个按钮 "连接",在点击 "连接 "的发布者初始化和点击 "断开 "按钮,我断开会话。在应用程序中,我有一个按钮 "连接",在点击 "连接 "的发布者初始化,并在点击 "断开 "按钮,我断开了会议.我希望它的工作方式。

  1. 点击 "连接"--发布者初始化
  2. 点击断开连接--会话断开连接
  3. 点击连接--Publisher Initialized (但在这里我得到了错误)

Tokbox重新发布问题

OpenTok:Publisher:error _connectivityAttemptPinger should have been cleaned up +0ms

OpenTok:Publisher:error OT.Publisher State Change Failed:  +209ms 'PublishingToSession' cannot transition to 'PublishingToSession'

OpenTok:Publisher:error OT.Publisher.onPublishingTimeout +15s

OpenTok:GlobalExceptionHandler:error OT.exception :: title: Unable to Publish (1500) msg: ICEWorkflow +0ms

OpenTok:Session:error 1500 +0ms Session.publish :: Could not publish in a reasonable amount of time

OpenTok:Session:error 1500 +9ms Session.publish :: Session.publish :: Could not publish in a reasonable amount of time

代码如下。

tokBoxInit() {
if (OT.checkSystemRequirements() == 1) {

  this.session = OT.initSession(this.apiKey, this.sessionId);
  console.log(this.session);
  this.session.connect(this.token, function(error) {
    if (error) {
      console.log("Error connecting: ", error.name, error.message);
    } else {
      console.log("Connected to the session.");
    }
  });

this.publisher = OT.initPublisher('publisher',{insertMode: 'append',width: '100%',height: '100%'});

this.publisher.on({
  streamCreated: function (event) {},
  streamDestroyed: function (event) {}
});

this.session.on({
    sessionConnected: (event: any) => {
    console.log("Session Connected Listener");
    this.connected = true; // Status to show Connect/Disconnect Button
    this.session.publish(this.publisher);
    }
  });
  }
}
tokbox
1个回答
0
投票

你是如何处理断开连接功能的?你是否在连接被破坏后清除会话并取消发布被破坏的会话?

还有检查你的令牌功能是否有发布者或版主的角色,因为也可能是令牌没有这些属性。或者在重新生成会话时丢失。

opentok引用的1500错误信息有如下描述。

Unable to Publish. 客户端的token没有设置为发布或版主的角色。客户端连接到会话后,Session对象的能力属性会列出客户端的能力。

但是代码太简单了,看不出来,因为我看不出你是如何处理会话断开的,所以检查一下你是否处理了,断开后清除会话。

© www.soinside.com 2019 - 2024. All rights reserved.