Monitor AVPlayer (iOS)
Monitor AVPlayer (iOS)
FastPix Video Data SDK with AVPlayer enables tracking of key video performance metrics, making the data readily available on the FastPix dashboard for monitoring and analysis. While the SDK is developed in Swift, the published SPM package currently includes only the Swift output.
Key features:
- See how users interact with your videos.
- Track real-time metrics like bitrate, buffering, startup, render quality, and failures.
- Identify and fix video delivery bottlenecks on iOS.
- Get detailed error reports to quickly identify and fix playback issues.
- Customize tracking to match your specific business needs.
- Handle errors with robust reporting and diagnostics.
- View and compare metrics to make data-driven decisions.
Support for tvOS
Alongside iOS, the FastPix Video Data Core SDK also supports tvOS, allowing you to collect detailed playback analytics from your Apple TV apps when using AVPlayer. You can track viewer engagement, playback quality, errors, and custom events on Apple TV just as you do on iOS.
We’ve tested the SDK on tvOS to ensure a smooth experience, but if you encounter any issues or have questions, feel free to reach out to us.
Install and setup
Import the SDK
Basic integration
Include metadata
Emit custom events
Configure AVPlayer
Step 1
Install and setup
Step 2
Import the SDK
Step 3
Basic integration
Step 4
Include metadata
Step 5
Emit custom events
Detailed example
Configure AVPlayer
Prerequisites
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
You can integrate the SDK into your project using Swift Package Manager (SPM). Follow these steps to add the package to your iOS project.
-
Open your Xcode project and navigate to:
File → Add Packages
-
Enter the repository URL for the FastPix SDK: https://github.com/FastPix/iOS-data-avplayer-sdk
-
Choose the latest stable version and click Add Package.
-
Select the target where you want to use the SDK and click Add Package.
Step 2: Import the SDK
Step 3: Basic integration
Ensure that the workspace_id is provided, as it is a mandatory field for FastPix integration, uniquely identifying your workspace. Install and import AVFoundation into your project, and create an avplayer instance to bind it to. If you are using any other custom player then create an instance of that player.
Next, create an instance of initAvPlayerTracking for tracking the analytics. Once the video URL is loaded and playback has started, the SDK will begin tracking the analytics.
Step 4: Include metadata for tracking
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.
DEVELOPMENT TIP
Keep metadata consistent across different video loads to make comparison easier in your analytics dashboard.
Step 5: Emit custom events
Changing video streams in player
When playing multiple videos back-to-back, it’s essential to notify the FastPix SDK whenever a new video starts to ensure accurate tracking. You should signal a new source in the following scenarios:
- The player advances to the next video in a playlist.
- The user selects a different video to play.
To inform the FastPix SDK of a new view, emit a videoChange event immediately after loading the new video source:
PLEASE NOTE
Always ensure that this event is dispatched right after the new source is loaded to maintain accurate tracking.
Detailed example to configure AVPlayer
Here’s an example to help you integrate the FastPix Data SDK with AVPlayer.
You can use this code in your application:
Release notes
For a complete release history, including new features, improvements, and bug fixes, see the FastPix AVPlayer (iOS) SDK CHANGELOG on GitHub.