In order to communicate with our servers, you will need to start a session using your Video.io API token.
Sessions are started through the
SessionManager and you have two options to do that:
Session token is a unique token generated for every user of your app. It should be generated by your backend service using this API. This API takes your app token (from the previous step) and identity. Identity is a user unique string, such as user id or nickname. It is important to use the same identity for the same user, so all videos created by this user will be associated with them.
Alternatively, if you don't have your own backend or you just want to test VideoKit you can pass
identity directly into
You should remember that exposing your
appTokento the public could be dangerous, because
appTokengives full controls over your video.io application.
If you include VideoKit using CDN files and script tag, you could also initialize session using query parameters in script url:
To clear the current session, simply call:
You could also subscribe on session state updates as follows: