api.video Player analytics plugin
api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
Table of contents
- Table of contents
- Project description
- Getting started
This is useful if you are using a video player for which we do not yet provide a ready-to-use monitoring module.
If you use one of the following video player, you should rather use the associated packaged monitoring module:
This module is compatible with React Native.
Method #1: requirejs
If you use requirejs you can add the module as a dependency to your project with
You can then use the module in your script:
var = ; const = new;
Method #2: typescript
If you use Typescript you can add the SDK as a dependency to your project with
You can then use the SDK in your script:
Include the SDK in your HTML file like so:
Then, once the
window.onload event has been trigered, instanciate the module with
The analytics module constructor takes a
PlayerAnalyticsOptions parameter that contains the following options:
|mediaUrl||yes||string||url of the media (eg.
||object containing metadata (see Full example below)|
||if only a sequence of the video is going to be played|
||callback to be called once the session id is reveiced|
Once the module is instanciated, the following methods have to be called to monitor the playback events.
method to call when the video starts playing for the first time (in the case of a resume after paused, use
method to call when the video playback is resumed after a pause
method to call once the player is ready to play the media
method to call when the video is ended
seek(from: number, to: number): Promise<void>
method to call when a seek event occurs, the
toparameters are mandatory and should contains the seek start & end times in seconds
method to call when the video is paused
method to call when the video player is disposed (eg. when the use closes the navigation tab)
updateTime(time: number): Promise<void>
method to call each time the playback time changes (it should be called often, the accuracy of the collected data depends on it)
Was this page helpful?