Skip to content Skip to sidebar Skip to footer

How To Know The Time Duration A Token Was Streaming It's Video To A Session In Opentok

I connected , subscribed to a session in opentok with a token and streamed my video. Now How do I get informations like How much time did my video streamed, and many other informat

Solution 1:

You have to keep track of these data yourself. For example, after creating a publisher you can send a post request to your server with the current timestamp Date.now()

When the user disconnects, you will get a sessionDisconnected event from someone else in the session, you can send an event to your server with the current timestamp Date.now() to mark the end time.

To identify the streams that have been disconnected, simply make sure you are sending the user's connectionId in your requests: session.connection.connectionId and stream.connection.connectionId

Alternatively, you can try out OpenTok's raptor SDK, which is simply a Java SDK that you can use in your Java backend to get a request every time a user connects/disconnects to a session and other events. Unfortunately this only works with Java for now, OpenTok will work to support more SDKs soon.

Post a Comment for "How To Know The Time Duration A Token Was Streaming It's Video To A Session In Opentok"