【问题标题】:How can I reliably get the timestamp of when a particular participant leaves(and joins) a room in twilio?如何在 twilio 中可靠地获取特定参与者离开(和加入)房间的时间戳?
【发布时间】:2017-09-15 09:18:03
【问题描述】:

我正在使用 twilio 的程序化视频 api 构建一个视频聊天应用程序。并且想知道特定参与者在房间中连接了多少分钟。

我目前正在监听 roomJoined 和 room.on('disconnected') 事件以执行 ajax 请求并使用 Date.Now() 更新服务器上的时间戳。 但是在某些情况下,当用户关闭浏览器窗口时,附加到断开连接事件的请求不会触发,因为在执行该代码之前从 dom 中删除了 javascript。

有没有可靠的方法来获取这些信息?

【问题讨论】:

    标签: javascript video twilio twilio-api


    【解决方案1】:

    这里是 Twilio 开发者宣传员。

    好消息,您现在可以从这些房间create rooms using the REST APIsetup to receive status callback webhooksdocumentation for status callbacks are here,但你想要的重要回调是participant-disconnected

    此特定事件带有其他人没有的参数。 ParticipantDuration,即参与者的连接时长。

    如果有帮助,请告诉我。

    【讨论】:

    • 当我尝试使用其他 API 创建房间时,我收到此错误:无法读取未定义的属性“房间”。这是代码:client.video.rooms .create({ uniqueName: req.params.id, statusCallback: 'localhost:3000/classrooms/listen' });
    • 您使用的是哪个版本的 Twilio 节点模块?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-26
    • 1970-01-01
    • 2021-04-02
    • 1970-01-01
    相关资源
    最近更新 更多