简体   繁体   English

Js Opentok(Tokbox)显示等待状态。

[英]Js Opentok (Tokbox) Show waiting Status.

I am creating an conference page where two users can have a video conference call. 我正在创建一个会议页面,两个用户可以在其中进行视频电话会议。

for video conference i am using Opentok Tokbox facility , 对于视频会议,我正在使用Opentok Tokbox工具,

Problem : 问题:

consider a scenario where User 1 joins the conference room and he is not accompanied by the second user and he is waiting for the second user to join the conference , so in that case i wanted to display a note to the user "Please wait for the user" 考虑以下情况:用户1加入会议室,但他没有第二个用户陪同,并且他正在等待第二个用户加入会议,因此在这种情况下,我想向用户显示注释“请稍等。用户”

and once the user joins in then the message should be replaced with the video Conference Meeting as done in the below js code, 用户加入后,该消息应替换为视频会议会议,如下面的js代码所示,

  session.connect(token, function(error) {           
     var publisher = OT.initPublisher('video_conf',pubOptions);              
     session.publish(publisher);         
   });

<div id="video_conf" class="video_conf">Here i want the note to be Displayed</div>

I am using the above code to publish the video conference after creating the session where video_conf is the div class where the conference is getting published. 创建会话后,我正在使用上面的代码发布视频会议,其中video_conf是要发布会议的div类。

Thanks a lot for the help :) 非常感谢您的帮助 :)

You would need to connect to the session by default, as you can't see session events if you are not connected. 默认情况下,您需要连接到会话,因为如果未连接,则看不到会话事件。 You should have the waiting page activate in session.connect(), and have a session event listener to deactivate the waiting page when someone joins. 您应该在session.connect()中激活等待页面,并使用会话事件监听器在某人加入时停用等待页面。 Here is an example session event listener and handler: 这是会话事件侦听器和处理程序的示例:

session.connect(token, function(error) {           
   var publisher = OT.initPublisher('video_conf',pubOptions);              
   session.publish(publisher);         
   enableWaitingSign();
});

session.on('streamCreated', function (event) {
  //Someone else has joined the session  
  disableWaitingSign();
  session.subscribe(event.stream);
});

JS documentation on sessions: https://tokbox.com/developer/sdks/js/reference/Session.html 关于会话的JS文档: https : //tokbox.com/developer/sdks/js/reference/Session.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM