Monitor THEOPlayer

Understand how FastPix THEOPlayer SDK tracks playback, performance, and user interactions on Android.

The FastPix Data SDK with THEOplayer 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.

Prerequisites:

To track and analyze video performance, initialize the SDK with your Workspace key. Learn about Workspaces.

  1. Access the FastPix Dashboard: Log in and navigate to the Workspaces section.
  2. Locate Your Workspace Key: Copy the Workspace Key for client-side monitoring. Include this key in your Java/Kotlin code on every page where you want to track video performance.

Install and setup

  1. Open your Android Studio project where you want to integrate the SDK.

  2. Add the FastPix Data SDK dependency:

  3. Navigate to your app-level build.gradle file (or build.gradle.kts if using Kotlin DSL).

1implementation "io.fastpix.data:theo:0.0.2"

Navigate to your settings.gradle file

1dependencyResolutionManagement {
2 repositories {
3 google()
4 mavenCentral()
5 maven {
6 url = uri("https://maven.pkg.github.com/FastPix/android-data-theoplayer")
7 credentials {
8 username =
9 project.findProperty("lpr.user")
10 password =
11 project.findProperty("lpr.key")
12 }
13 }
14 }
15}
  1. Sync your project with Gradle files Click Sync Now in the notification bar to download and integrate the FastPix Data SDK.

Import the SDK

1import io.fastpix.data.domain.model.CustomDataDetails
2import io.fastpix.data.domain.model.PlayerDataDetails
3import io.fastpix.data.domain.model.VideoDataDetails
4import io.fastpix.theo_player_data.CustomerData
5import io.fastpix.theo_player_data.FastPixBaseTheoPlayer

Basic Integration

1.Ensure that the workSpaceId is provided, as it is a mandatory field for FastPix integration, uniquely identifying your workspace. Install and import THEOplayer into your project, and create an theoplayer instance to bind it to. If you are using any other custom player then create an instance of that player.

  1. Next, create an instance of FastPixBaseTheoPlayer to track analytics. After the video URL loads and playback begins, the SDK automatically begins tracking analytics.
1import ...
2class MainActivity : AppCompatActivity() {
3 private var theoPlayerData: FastPixBaseTheoPlayer? = null
4}
  1. You can initialize THEOPlayer with a THEOplayerView in your Android application to enable seamless functionality. Use the following Kotlin or Java code in your Android application to configure ExoPlayer with FastPix:
1val videoDataDetails = VideoDataDetails(
2 videoId = "video-id",
3 videoTitle = "video-title",
4)
5val customerData = CustomerData(
6 workSpaceId = "workspace-id",
7 videoDetails = videoDataDetails,
8 playerData = PlayerDataDetails("player-name", "player-version"),
9 customDataDetails = CustomDataDetails(
10 customField1 = "field1",
11 customField2 = "field2",
12 // Add more custom fields as needed
13 )
14)
15theoPlayerData = FastPixBaseTheoPlayer(
16 this, binding.theoPlayerView,
17 customerData = customerData,
18 enableLogging = true
19)

Include custom data and metadata

  • workSpaceId is a mandatory parameter that tells the SDK on which workspace the data will collect.
  • playerView is another mandatory parameter coming THEOPlayer view.
  1. You can use custom metadata fields like customField1 to customField10 for your business logic, giving you the flexibility to pass any required values. Named attributes, such as videoId and videoTitle, can be passed directly as they are. See the user-passable metadata documentation to see the metadata supported by FastPix.
1val videoDataDetails = VideoDataDetails(
2 videoId = "video-id",
3 videoTitle = "video-title",
4 videoSeries = "Video Series",
5 videoProducer = "Video Producer",
6 videoContentType = "Video Content Type",
7 videoVariant = "Video Variant",
8 videoLanguage = "Video Language",
9 videoDrmType = "Drm Type"
10)
11val customerData = CustomerData(
12 workSpaceId = "workspace-id",
13 videoDetails = videoDataDetails,
14 beaconUrl = "beacon-url",
15 playerData = PlayerDataDetails("Theo-player", "5+"),
16 customDataDetails = CustomDataDetails(
17 customField1 = "field1",
18 customField2 = "field2",
19 // Add more custom fields as needed
20 )
21)
  1. To set up video analytics, create a FastPixBaseTheoPlayer object by providing the following parameters: your application’s Context (usually the Activity), the THEOPlayer instance, and the customerData.
1theoPlayerData = FastPixBaseTheoPlayer(
2 this, binding.theoPlayerView,
3 customerData = customerData,
4 enableLogging = true
5)
  1. Finally, when destroying the player, make sure to call the FastPixBaseTheoPlayer.release() function to properly release resources.
1override fun onDestroy() {
2 super.onDestroy()
3 theoPlayerData?.release() // Cleanup FastPix tracking
4}
  1. 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 workspaceId, and look for video views.

Understanding CustomerData

FieldPurposeRequired
workSpaceIdYour FastPix workspace identifier
beaconUrlOptional override tracking endpoint
videoDetailsMetadata describing the video
playerDataPlayer descriptor (defaults to THEOplayer + version)
customDataDetailsAdditional custom tags

What FastPix Tracks

After initialization, the SDK automatically collects:

CategoryExamples
Playback eventsplay, pause, playing, ended
Buffer eventsbuffering, buffered
Seek behaviorseeking, seeked
QoS metricsbitrate, resolution, FPS (when available)
ErrorsTHEOplayer error codes and messages
Player metadatafullscreen, autoplay, MIME type etc

Example to configure THEOPlayer with FastPix Data SDK.

Provide your stream URL in the url field “https://example.com/video.m3u8” and your FastPix workspace key in the workspaceIdfield.

1class PlayerActivity : AppCompatActivity() {
2
3 private lateinit var theoPlayerView: THEOplayerView
4 private lateinit var theoPlayerData: FastPixBaseTheoPlayer
5
6 override fun onCreate(savedInstanceState: Bundle?) {
7 super.onCreate(savedInstanceState)
8 setContentView(R.layout.activity_player)
9
10 theoPlayerView = findViewById(R.id.theoPlayerView)
11
12 val videoDataDetails = VideoDataDetails(
13 videoId = "video-id",
14 videoTitle = "video-title",
15 videoSeries = "Video Series",
16 videoProducer = "Video Producer",
17 videoContentType = "Video Content Type",
18 videoVariant = "Video Variant",
19 videoLanguage = "Video Language",
20 videoDrmType = "Drm Type"
21 )
22 val customerData = CustomerData(
23 workSpaceId = "workspace-id",
24 videoDetails = videoDataDetails,
25 playerData = PlayerDataDetails("player-name", "player-version"),
26 customDataDetails = CustomDataDetails(
27 customField1 = "field1",
28 customField2 = "field2",
29 // Add more custom fields as needed
30 )
31 )
32 theoPlayerData = FastPixBaseTheoPlayer(
33 this, binding.theoPlayerView,
34 customerData = customerData,
35 enableLogging = true
36 )
37
38 theoPlayerView.player.source = MediaSource("https://example.com/video.m3u8")
39 theoPlayerView.player.play()
40 }
41
42 override fun onDestroy() {
43 fastPixTheoPlayer.release()
44 super.onDestroy()
45 }
46}

Debug Logging

Enable logs using:

1enableLogging = true

Change logs

All notable changes to this project will be documented in this file.

[v0.3.0]

  • Code standardization updates applied across the SDK to align with best practices and strengthen overall stability.

[v0.2.0]

  • Updated iOS Data Core SDK by updating the SDK’s default metrics collection domain to improve endpoint reliability and alignment with current infrastructure.

[v0.1.0]

Added

  • Integration with THEOPlayer:

    • Enabled video performance tracking using FastPix Data SDK, supporting user engagement metrics, playback quality monitoring, and real-time streaming diagnostics.
    • Provides robust error management and reporting capabilities for video performance tracking.
    • 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 videoChange to handle metadata updates during playback transitions.

Support

📩 Email: support@fastpix.io 📚 Docs: fastpix.com/docs