Socket
Socket
Sign inDemoInstall

video.api:android-player-analytics

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

video.api:android-player-analytics

Android player analytics library for api.video service.


Version published
Maintainers
1
Source

badge   badge   badge

api.video Android player analytics module

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

Project description

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.

Getting started

Installation

Gradle

In your module build.gradle, add the following code in dependencies:

dependencies {
    implementation 'video.api:android-player-analytics:2.0.2'
}

Permissions

In your AndroidManifest.xml, add the following code in <manifest>:


<uses-permission android:name="android.permission.INTERNET" />

Sample application

A demo application demonstrates how to use player analytics library. See /example folder.

Documentation

Options

The analytics module constructor takes a Options parameter that contains the following options:

Option nameMandatoryTypeDescription
mediaUrl**
yes**Stringurl of the media (eg. https://vod.api.video/vod/vi5oDagRVJBSKHxSiPux5rYD/hls/manifest.m3u8)
videoInfo**
yes**VideoInfoinformation containing analytics collector url, video type (vod or live) and video id
metadatanoMap<String, String>object containing metadata
onSessionIdReceivedno((sessionId: String) -> Unit)?callback called once the session id has been received
onPingno((message: PlaybackPingMessage) -> Unit)?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.

ApiVideoPlayerAnalytics API

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())

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 from and to parameters 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)

currentTime

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.

API documentation

A complete API documentation is available.

FAQs

Package last updated on 09 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc