api.video Android 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
- Sample application
Android library to manually call the api.video analytics collector.
This is useful if you are using a video player for which we do not yet provide a ready-to-use monitoring module.
This module also supports ExoPlayer analytics.
In your module
build.gradle, add the following code in
AndroidManifest.xml, add the following code in
A demo application demonstrates how to use player analytics library.
The analytics module constructor takes a
Options parameter that contains the following options:
|yes**||String||url of the media (eg.
|yes**||VideoInfo||information containing analytics collector url, video type (vod or live) and video id|
||object containing metadata|
||callback called once the session id has been received|
||callback called before sending the ping message|
Options instantiation is made with either mediaUrl or videoInfo.
Once the module is instantiated, the following methods have to be called to monitor the playback events.
Event time or current time
If you know the event timestamp, you can use it as the
eventTime parameter. If you don't know the
event timestamp, you can set the
currentTime parameter with a scheduler.
play(eventTime: Float = currentTime): Future<void>
method to call when the video starts playing for the first time (in the case of a resume after paused, use
resume(eventTime: Float = currentTime): Future<void>
method to call when the video playback is resumed after a pause
ready(eventTime: Float = currentTime): Future<void>
method to call once the player is ready to play the media
end(eventTime: Float = currentTime): Future<void>
method to call when the video is ended
seek(from: Float, to: Float): Future<void>
method to call when a seek event occurs, the
toparameters are mandatory and should contains the seek start & end times in seconds
pause(eventTime: Float = currentTime): Future<void>
method to call when the video is paused
destroy(eventTime: Float = currentTime): Future<void>
method to call when the video player is disposed (eg. when the use closes the navigation tab)
field to call each time the playback time changes (it should be called often, the accuracy of the collected data depends on it) if you don't know event time.
A complete API documentation is available.
Was this page helpful?