Monitor ExoPlayer
The FastPix Data SDK with ExoPlayer helps you track key video metrics like user interactions, playback quality, and performance to enhance the viewing experience. It lets you customize data tracking, monitor streaming quality, and securely send insights for better optimization and error resolution.
Key features:
- Capture user engagement through detailed viewer interaction data.
- Monitor playback quality with real-time performance analysis.
- Identify and fix video delivery bottlenecks on Android.
- Customize tracking to match specific monitoring needs.
- Handle errors with robust reporting and diagnostics.
- Gain deep insights into video performance with streaming diagnostics.
Install and setup
Import the SDK
Basic integration
Add metadata
Advanced Customization
Emit custom events
Configure ExoPlayer
Step 1
Install and setup
Step 2
Import the SDK
Step 3
Basic integration
Step 4
Add metadata
Step 5
Advanced Customization
Step 6
Emit custom events
Detailed example
Configure ExoPlayer
Prerequisites
- To track and analyze video performance, initialize the FastPix Data SDK with your Workspace key. This key is essential for client-side monitoring and must be included in your Android application’s code wherever you want to track video performance.
- An existing Android Studio project where you plan to integrate the FastPix Data SDK.
- Gradle configured in your project for managing dependencies.
- ExoPlayer pre-installed and integrated with your project for FastPix data setup.
Step 1: Install and setup
-
Open your Android Studio project where you want to integrate the SDK.
-
Add the FastPix Data SDK dependency:
Navigate to your app-level build.gradle file (or build.gradle.kts if using Kotlin DSL).
Navigate to your settings.gradle file
-
Sync your project with Gradle files
Click “Sync Now” in the notification bar to download and integrate the FastPix Data SDK.
Once the above dependency is added, you can use the FastPix Data SDK module into your Android project where you intend to use its functionalities.
PLEASE NOTE
To ensure accurate analytics, initialize and complete the ExoPlayer setup first. Once the player is fully ready, integrate and start the Android data analytics SDK in your project.
Step 2: Import the SDK
Step 3: Basic integration
Globally declare
You need to globally declare the ExoPlayer instance and FastPixBaseExoPlayer in your Android application. A global declaration ensures that these objects can be accessed throughout the lifecycle of your activity or application where required.
You can initialize ExoPlayer with a PlayerView or SurfaceView in your Android application to enable seamless functionality. Use the following Kotlin or Java code in your Android application to configure ExoPlayer with FastPix:
Step 4: Including custom data and metadata
workSpaceIdis a mandatory parameter that tells the SDK on which workspace the data will collect.playerViewis another mandatory parameter.exoPlayeris also a mandatory parameter that SDK uses to anylyze the playback.
Check out the user-passable metadata documentation to see the metadata supported by FastPix. You can use custom metadata fields like custom_1 to custom_10 for your business logic, giving you the flexibility to pass any required values. Named attributes, such as video_title and video_id, can be passed directly as they are.
To set up video analytics, create a FastPixBaseExoPlayer object by providing the following parameters: your application’s Context (usually the Activity), the ExoPlayer instance, and the customerDataEntity and customOptions objects that you have prepared.
Finally, when destroying the player, make sure to call the FastPixBaseExoPlayer.release() function to properly release resources.
After completing the integration, start playing a video in your player. A few minutes after stopping playback, you’ll see the results in your FastPix Video Data dashboard. Log in to the dashboard, navigate to the workspace associated with your ws_key, and look for video views.
Example to configure ExoPlayer with FastPix Data SDK.
Here are platform-specific examples to help you integrate the FastPix Data SDK with your ExoPlayer. Use the following Kotlin or Java code into your application:
Changelog
All notable changes to the ExoPlayer (Android) Video Player SDK is documented below.
Current version
[1.1.4]
- Upgrades Core SDK to 1.3.1
- Removes synchronous bandwidth data capture and storage in
onLoadCanceledto streamline event dispatching.
Previous version
[1.1.3]
- Upgrades Core SDK to 1.3.0
[1.1.2]
Improves pulse analytics dispatch behavior during playback state transitions and updates SDK versions/documentation.
General
- Updates
coreSDK version to1.2.9inlibs.versions.toml. - Updates
FastPixExoplayerLibraryInfoSDK version constant to1.1.2.
FastPixBaseExoPlayer
- Ensures pulse events are scheduled on
viewBegin,play, andbufferinginstead of being canceled. - Prevents unnecessary pulse cancellation on
playerReady,seeking, andbuffered. - Updates
seekedhandling to cancel pulse events only when playback is not active, and keep pulse scheduling when playback continues. - Stops scheduling pulse events on
variantChangedto avoid unintended heartbeat behavior during rendition switches.
[1.1.1]
Updates versions, refactors FastPixBaseExoPlayer to improve event handling, and enhances documentation.
General
- Updates
coreSDK version to1.2.7inlibs.versions.toml. - Updates
exoplayer-data-sdkMaven publication version to1.1.1. - Configures
settings.gradle.ktsto load GitHub credentials fromlocal.properties.
FastPixBaseExoPlayer
- Refactors SDK initialization to use
FastPixAnalyticssingleton. - Implements a coroutine-based pulse event system for periodic analytics heartbeats.
- Adds comprehensive state tracking for playback (playing, buffering, seeking, ended).
- Improves bandwidth and chunk load tracking, including better handling of canceled and failed requests.
- Ensures proper resource cleanup in
release()by canceling background jobs and clearing state. - Adds
FastPixExoplayerLibraryInfoto track SDK name and version.
Documentation
- Overhauls
README.mdwith updated requirements, simplified installation steps, and clearer Kotlin integration examples. - Adds version
1.1.1toCHANGELOG.md.
v1.1.0
Changed
- Major Code Optimization and Refactoring:
- Comprehensive code refactoring for improved maintainability and performance.
- Optimized internal components and dependencies for better efficiency.
- Enhanced code structure and organization across the SDK.
- Improved overall stability and reduced technical debt.
v1.0.0
Added
- Integration with ExoPlayer:
- Enabled video performance tracking using FastPix Data SDK, supporting ExoPlayer streams with user engagement metrics, playback quality monitoring, and real-time diagnostics.
- Provides robust error management and reporting capabilities for seamless ExoPlayer video performance tracking.
- Allows customizable behavior, including options to disable data collection, respect Do Not Track settings, and configure advanced error tracking with automatic error handling.
- Includes support for custom metadata, enabling users to pass optional fields such as
video_id,video_title,video_duration, and more. - Introduced event tracking for onPlayerStateChanged and onTracksChanged to handle seamless metadata updates during playback transitions.