Monitor Brightcove Player (Android)
This FastPix Data SDK integration for Brightcove Player 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. The integration enables comprehensive video performance tracking and user engagement metrics with minimal setup required.
Key features:
- Seamless integration with Brightcove Player events
- Automatic beacon domain selection for staging and production environments
- Simple configuration objects for quick setup
- Automatic cleanup of analytics resources
- Capture detailed viewer interaction data
- Monitor playback quality and streaming diagnostics
- Robust error reporting and diagnostics
Step 1
Install and setup
Step 2
Import the SDK
Step 3
Basic integration
Step 4
Configuration options
Step 5
Setup player interface
Detailed example
Configure player
Prerequisites
- An existing Android Studio project where you plan to integrate the FastPix Data SDK
- Gradle configured in your project for managing dependencies
- GitHub Personal Access Token (PAT) from your GitHub account for SDK access.
- To track and analyze video performance, initialize the SDK with your Workspace key. Learn about Workspaces.
- Access the FastPix Dashboard: Log in and navigate to the Workspaces section.
- Locate Your Workspace Key: Copy the Workspace Key for client-side monitoring. Include this key in your Swift code on every page where you want to track video performance.
Step 1: Install and setup
- Open your Android Studio project where you want to integrate the SDK.
- Add the required dependencies:
Navigate to your app-level build.gradle file (or build.gradle.kts if using Kotlin DSL).
//Add the following lines under the dependencies section:
dependencies{
// check with latest Fastpix Data SDK (media3) version
implementation("io.fastpix.data:media3:1.0.2")
// check with latest Brightcove Player SDK version
implementation("com.brightcove.player:exoplayer2:10.2.0")
// check with latest Fastpix Brightcove Player Data SDK version
implementation("io.fastpix.data:brightcoveplayer:1.0.0")
}
Navigate to your settings.gradle file
repositories {
maven {
url = uri("https://repo.brightcove.com/releases")
}
maven { url = uri("https://jitpack.io") }
maven {
url = uri("https://maven.pkg.github.com/FastPix/android-data-media3-player-sdk")
url = uri("https://maven.pkg.github.com/FastPix/android-data-brightcove")
credentials {
// Your GitHub account username (or FastPix)
username = "Github Username"
// Your Personal Access Token (PAT) from your GitHub account
password = "Personal Access Token"
}
}
}
- 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.
Step 2: Import the SDK
import io.fastpix.data.brightcove.BrightcoveBase
import io.fastpix.data.brightcove.FastPixConfig
Step 3: Basic Integration
Create your activity:
Extend the provided base class and implement the required configuration.
class MainActivity : BrightcoveBase() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
// Initialize view binding
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
// Set the Brightcove video view
brightcoveVideoView = binding.brightcoveVideoView
// Call super to initialize analytics
super.onCreate(savedInstanceState)
initializeAnalytics()
// Configure and play your video
val videoUrl = "Your Stream Url"
val video = Video.createVideo(videoUrl, DeliveryType.HLS)
// Start playback
brightcoveVideoView.add(video)
brightcoveVideoView.start()
}
// Required: Provide your FastPix workspace key
override fun getFastPixConfig() = FastPixConfig("Your Fastpix Workspace Key")
}
public class MainActivity extends BrightcoveBase {
private ActivityMainBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialize view binding
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
// Set the Brightcove video view
brightcoveVideoView = binding.brightcoveVideoView;
// Initialize analytics tracking
initializeAnalytics();
// Configure and play your video
String videoUrl = "Your Stream Url";
Video video = Video.createVideo(
videoUrl,
DeliveryType.HLS
);
// Start playback
brightcoveVideoView.add(video);
brightcoveVideoView.start();
}
// Required: Provide your FastPix workspace key
@Override
public FastPixConfig getFastPixConfig() {
return new FastPixConfig("Your FastPix Workspace Key");
}
}
Step 4: Configuration options
Check out the user-passable metadata documentation to see the metadata supported by FastPix. WorkspaceKey is the only mandatory field. While all metadata fields are optional, providing comprehensive metadata greatly enhances analytics insights and reporting capabilities
Player configuration
Player Configuration establishes the foundational metadata for your video application instance within the FastPix analytics ecosystem. This configuration captures essential player-level attributes such as player name, version, initialization timing, and environmental settings that persist throughout the application lifecycle.
The configuration serves as the primary identification layer that distinguishes your player instance from others in the analytics dashboard, enabling accurate performance tracking and user engagement analysis.
Configure these settings during player initialization and maintain consistency across sessions to ensure reliable data correlation and meaningful analytics reporting:
Parameter | Type | Description |
---|---|---|
playerName | String | Name of your video player application |
playerVersion | String | Version of your player (default: "1.0.0" ) |
experimentName | String | A/B test experiment identifier |
pageType | String | Type of page hosting the player |
playerInitTime | Long | Player initialization timestamp in ms |
playerNameKey | String | Custom key for player identification |
playerVersionKey | String | Custom version identification key |
subPropertyId | String | Sub-property or section identifier |
viewerUserId | String | Logged-in user identifier |
playerAutoplayOn | Boolean | Whether autoplay is enabled |
Usage
playerConfig.apply {
playerName = "MyApp Player"
playerVersion = "2.1.0"
// remaining parameters
}
BrightcoveBase.Companion.getPlayerConfig().setPlayerName("MyApp Player"); BrightcoveBase.Companion.getPlayerConfig().setPlayerVersion("2.1.0");
// access remaining parameters in Player Configuration
Video configuration
Video Configuration defines the comprehensive metadata profile for individual video assets, enabling detailed content performance analysis and optimization insights.
This configuration layer captures video-specific information including content identification, technical specifications, delivery parameters, and contextual metadata that drives analytics reporting.
Each video asset requires dedicated configuration to establish proper tracking boundaries and ensure accurate session attribution. Update the video configuration immediately when loading new content to reset tracking metrics and maintain clean analytics data separation between different video assets:
Parameter | Type | Description |
---|---|---|
videoTitle | String | Title of the video content |
sourceUrl | String | Video stream source URL |
videoCdn | String | Content Delivery Network provider |
videoContentType | String | Type of video content |
videoDuration | Long | Video duration in seconds |
videoEncodingVariant | String | Video encoding format |
videoId | String | Unique identifier for the video |
videoIsLive | Boolean | Whether this is a live stream |
videoLanguageCode | String | Language code (ISO 639-1) |
videoProducer | Boolean | Content producer or studio name (likely should be String ) |
videoSeries | String | Series or season information |
videoStreamType | String | Stream delivery type |
videoVariantId | String | Variant identifier for A/B testing |
videoVariantName | String | Human-readable variant name |
videoExperiments | String | Experiment group identifier |
Usage
videoConfig.apply {
videoTitle = "My Video"
videoId = "video_123"
sourceUrl = "Your Stream Url"
// Access remaining Video Configuration parameters here
}
BrightcoveBase.Companion.getVideoConfig().setVideoTitle("My Video");
BrightcoveBase.Companion.getVideoConfig().setVideoId("video_123");
// Access remaining Video Configuration parameters here
View configuration
View Configuration manages session-specific tracking parameters that enable precise user journey analysis and engagement measurement. This configuration handles unique session identification through generated session IDs and contextual data that supports detailed user behavior tracking across individual viewing experiences.
Each view session represents a discrete analytics boundary with dedicated tracking parameters that remain consistent throughout a single playback experience.
Generate new view configuration for each distinct playback session to ensure accurate measurement of user engagement patterns and enable sophisticated analytics correlation across your video platform.
Parameter | Type | Description |
---|---|---|
viewSessionId | String | Unique session identifier for each playback |
viewDrmType | String | DRM type if using content protection |
viewDrmTypeKey | String | Custom DRM configuration key |
viewSessionIdKey | String | Custom session identification key |
internalViewSessionId | Long | Internal tracking session identifier |
internalVideoExperiments | String | Internal experiment tracking identifier |
Usage
viewConfig.apply {
viewSessionId = UUID.randomUUID().toString()
viewDrmType = "Your DRM Type"
// Access the remaining View Configuration parameters here
}
BrightcoveBase.Companion.getViewConfig().setViewSessionId(UUID.randomUUID().toString());
BrightcoveBase.Companion.getViewConfig().setViewDrmType("Your DRM Type");
// Access the remaining View Configuration parameters here
Step 5: Setup player interface
Add the Brightcove PlayerView
to your layout:
<com.brightcove.player.view.BrightcoveExoPlayerVideoView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/brightcove_video_view"
android:layout_gravity="center"/>
Detailed implementation example
Here are platform-specific examples to help you integrate the FastPix Data SDK with your Brightcove player. Use the following Kotlin or Java code into your application:
class MainActivity : BrightcoveBase() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
brightcoveVideoView = binding.brightcoveVideoView
super.onCreate(savedInstanceState)
// Required for fastpix metrics
initializeAnalytics()
val videoUrl = "Your Stream Url"
val video = Video.createVideo(videoUrl, DeliveryType.HLS)
// Configure your video data
videoConfig.sourceUrl = videoUrl
videoConfig.videoTitle = "Brightcove Testing"
configure your player data
playerConfig.playerVersion = "2.1.0"
playerConfig.playerName = "Brightcove Player"
//configure your view data
viewSessionId = UUID.randomUUID().toString()
viewDrmType = "Your DRM Type"
// Required beacon domain or else it will take "metrix.ws" by default
customOptions.beaconDomain="metrix.ninja"
brightcoveVideoView.add(video)
brightcoveVideoView.start()
}
// Required to call this funtion for the Fastpix analytics
override fun getFastPixConfig() = FastPixConfig("Your Workspace Key")
}
public class MainActivity1 extends BrightcoveBase {
private ActivityMainBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
brightcoveVideoView = binding.brightcoveVideoView;
// Initialize Analytics
initializeAnalytics();
// Set up your video URL and configurations
String videoUrl = "Your Stream Url";
Video video = Video.createVideo(videoUrl, DeliveryType.HLS);
// Set video, player, and view configurations
BrightcoveBase.Companion.getPlayerConfig().setPlayerName("MyApp Player");
BrightcoveBase.Companion.getPlayerConfig().setPlayerVersion("2.1.0");
BrightcoveBase.Companion.getVideoConfig().setVideoTitle("My Video");
BrightcoveBase.Companion.getVideoConfig().setVideoId("video_123");
BrightcoveBase.Companion.getViewConfig().setViewSessionId(UUID.randomUUID().toString());
BrightcoveBase.Companion.getViewConfig().setViewDrmType("Your DRM Type");
// Set the beacon domain to something custom like in Kotlin
BrightcoveBase.Companion.getCustomOptions().setBeaconDomain("metrix.ninja");
// Add video to player view and start it
brightcoveVideoView.add(video);
brightcoveVideoView.start();
}
@Override
public FastPixConfig getFastPixConfig() {
return new FastPixConfig("Your Fastpix Workspace Key");
}
}
Updated about 8 hours ago