简体   繁体   English

我如何可靠地获取特定参与者何时离开(并加入)twilio中的房间的时间戳?

[英]How can I reliably get the timestamp of when a particular participant leaves(and joins) a room in twilio?

I am building a video chat app using twilio's programmatic video api. 我正在使用twilio的程序化视频API构建视频聊天应用程序。 And would like to know how many minutes a particular participant is connected in a room. 并想知道特定参与者在一个房间中连接了多少分钟。

I am currently listening to the roomJoined and room.on('disconnected') events to do ajax requests and update the timestamp on the server using a Date.Now(). 我目前正在监听roomJoined和room.on('disconnected')事件,以执行ajax请求并使用Date.Now()更新服务器上的时间戳。 But when the user closes the browser window in some cases, the request attached to the disconnected event wont fire as the javascript is removed from the dom before that code is executed. 但是在某些情况下,当用户关闭浏览器窗口时,附加到断开连接事件的请求不会触发,因为在执行该代码之前已从dom中删除了javascript。

Is there a reliable way to get this information? 是否有可靠的方法来获取此信息?

Twilio developer evangelist here. Twilio开发人员布道者在这里。

Good news, you can now create rooms using the REST API and setup to receive status callback webhooks from those rooms. 好消息,您现在可以使用REST API创建会议室并进行设置,以接收来自这些会议室的状态回调Webhook The documentation for status callbacks are here , but the important callback you want is the participant-disconnected . 状态回调文档在这里 ,但是您想要的重要回调是participant-disconnected

This particular event comes with a parameter that others do not. 此特定事件带有其他人没有的参数。 The ParticipantDuration , which is how long that participant was connected. ParticipantDuration ,即参与者连接的时间。

Let me know if that helps. 让我知道是否有帮助。

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

相关问题 使用twilio:将会议室中的特定参与者静音 - With twilio: Mute a specific participant in a room 如何将 Twilio 视频室流式传输给数千人? - How can I stream a Twilio video room to thousands? 如何检测用户何时进入或离开游戏并获取他们进入/离开的游戏名称? - How can I detect when a user enters or leaves a game and get the game name they entered/left? 如何检测成员何时加入和离开语音频道 - How to detect when a member joins & leaves a voice channel 如何检测鼠标何时离开窗口? - How can I detect when the mouse leaves the window? 我应该如何以可靠地用于转换为其他时区的方式在服务器端存储来自JS的时间戳? - How should I store a timestamp coming from JS on the server-side in a way that I can reliably use to convert to other timezones? 如何可靠地检查Google Analytics(分析)? - How can I reliably check for Google Analytics? 如何针对Hyperledger作曲家中的特定参与者? - how to target a particular participant in hyperledger composer? 如何可靠地取消 compositionstart 事件? - How can I reliably cancel a compositionstart event? 在 twilio-video 中,如果我连接到自动订阅设置为 false 的房间,我以后如何订阅远程曲目? - In twilio-video, how can I subscribe to remote tracks at later time if I connected to a room with automaticSubscription set to false?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM