Sign up for free

Project description

This library sends player events from the player to api.video.

Getting started

Installation

Gradle

For ExoPlayer, add the following code in your module build.gradle:

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

Code sample

Register the ExoPlayer player analytics agent with:

import androidx.media3.exoplayer.ExoPlayer
import video.api.player.analytics.exoplayer.extensions.addApiVideoAnalyticsListener

val exoplayer = ExoPlayer.Builder(context).build()
val listener =
    exoplayer.addApiVideoAnalyticsListener() // Register the ApiVideo exoplayer analytics listener so it sends player events to api.video.

// Remove the analytics listener when you don't need it anymore.
exoplayer.removeAnalyticsListener(listener)

For a custom domain collector, use:

val listener =
    exoplayer.addApiVideoAnalyticsListener(collectorUrl = "https://collector.mycustomdomain.com") // Register the player analytics listener so it sends player events to api.video.

Sample application

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

While running the example, you can set your video Id:

  1. Enter a new media Id
  2. Press on Load button

Documentation

A complete Android player analytics documentation is available.

FAQ

If you have any questions, ask us in the community or use Issues.

Was this page helpful?