Monitor THEOPlayer (Android)

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

Monitor THEOplayer (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).

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

Navigate to your settings.gradle file

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://maven.pkg.github.com/FastPix/android-data-theoplayer")
            credentials {
                username =
                    project.findProperty("lpr.user")
                password =
                    project.findProperty("lpr.key")
            }
        }
    }
}
  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

import io.fastpix.data.domain.model.CustomDataDetails
import io.fastpix.data.domain.model.PlayerDataDetails
import io.fastpix.data.domain.model.VideoDataDetails
import io.fastpix.theo_player_data.CustomerData
import 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.
import ... 
class MainActivity : AppCompatActivity() { 
    private var theoPlayerData: FastPixBaseTheoPlayer? = null
} 
  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:
val videoDataDetails = VideoDataDetails(
    videoId = "video-id",
    videoTitle = "video-title",
)
val customerData = CustomerData(
    workSpaceId = "workspace-id",
    videoDetails = videoDataDetails,
    playerData = PlayerDataDetails("player-name", "player-version"),
    customDataDetails = CustomDataDetails(
        customField1 = "field1",
        customField2 = "field2",
        // Add more custom fields as needed
    )
)
theoPlayerData = FastPixBaseTheoPlayer(
    this, binding.theoPlayerView,
    customerData = customerData,
    enableLogging = true
)

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.
val videoDataDetails = VideoDataDetails(
    videoId = "video-id",
    videoTitle = "video-title",
    videoSeries = "Video Series",
    videoProducer = "Video Producer",
    videoContentType = "Video Content Type",
    videoVariant = "Video Variant",
    videoLanguage = "Video Language",
    videoDrmType = "Drm Type"
)
val customerData = CustomerData(
    workSpaceId = "workspace-id",
    videoDetails = videoDataDetails,
    beaconUrl = "beacon-url",
    playerData = PlayerDataDetails("Theo-player", "5+"),
    customDataDetails = CustomDataDetails(
        customField1 = "field1",
        customField2 = "field2",
        // Add more custom fields as needed
    )
)
  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.
theoPlayerData = FastPixBaseTheoPlayer(
    this, binding.theoPlayerView,
    customerData = customerData,
    enableLogging = true
)
  1. Finally, when destroying the player, make sure to call the FastPixBaseTheoPlayer.release() function to properly release resources.
override fun onDestroy() { 
  	super.onDestroy() 
	theoPlayerData?.release() // Cleanup FastPix tracking 
} 
  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.

class PlayerActivity : AppCompatActivity() {

    private lateinit var theoPlayerView: THEOplayerView
    private lateinit var theoPlayerData: FastPixBaseTheoPlayer

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_player)

        theoPlayerView = findViewById(R.id.theoPlayerView)

         val videoDataDetails = VideoDataDetails(
            videoId = "video-id",
            videoTitle = "video-title",
            videoSeries = "Video Series",
            videoProducer = "Video Producer",
            videoContentType = "Video Content Type",
            videoVariant = "Video Variant",
            videoLanguage = "Video Language",
            videoDrmType = "Drm Type"
        )
        val customerData = CustomerData(
            workSpaceId = "workspace-id",
            videoDetails = videoDataDetails,
            playerData = PlayerDataDetails("player-name", "player-version"),
            customDataDetails = CustomDataDetails(
                customField1 = "field1",
                customField2 = "field2",
                // Add more custom fields as needed
            )
        )
        theoPlayerData = FastPixBaseTheoPlayer(
            this, binding.theoPlayerView,
            customerData = customerData,
            enableLogging = true
        )

        theoPlayerView.player.source = MediaSource("https://example.com/video.m3u8")
        theoPlayerView.player.play()
    }

    override fun onDestroy() {
        fastPixTheoPlayer.release()
        super.onDestroy()
    }
}

Debug Logging

Enable logs using:

enableLogging = true

Support

📩 Email: [email protected] 📚 Docs: https://docs.fastpix.io