Monitor Chromecast | Mux
Monitor Chromecast
Connect Mux Data to Chromecast to collect playback performance metrics. Use this guide when your Chromecast receiver application plays video.
In this guide:
Include the Mux Data SDK
Install@mux/mux-data-chromecastinto your Chromecast application.Initialize Mux Data
Attach@mux/mux-data-chromecastto your player so that Mux can collect playback metrics.Make your data actionable
Use metadata fields to make the data collected by Mux actionable and useful.Set or update metadata after initialization
If you do not have all the metadata available at initialization time update metadata fields later.Changing the video
If your application plays multiple videos back-to-back in the same player, make sure that you let@mux/mux-data-chromecastknow.Advanced options
Depending on the details of your implementation, you may want to leverage some of the advanced options of@mux/mux-data-chromecast.
Mux Data collects playback performance metrics from Chromecast receiver applications. Use this guide when your Chromecast receiver application plays video and you want to monitor the playback experience of your viewers. You do not need Mux Video to use Mux Data.
Mux Data is the best way to monitor video streaming performance. Integration is easy - just initialize the Mux SDK, pass in some metadata, and you're up and running in minutes. This documents integration instructions for Chromecast. For other players, see the additional Integration Guides.
Features
The following data can be collected by the Mux Data SDK when you use the Chromecast SDK:
- Engagement metrics
- Quality of Experience Metrics
- Web metrics such as Player Startup Time, Page Load Time, etc
- Average Bitrate metrics and
renditionchangeevents - Request metrics
- Customizable Error Tracking
- Custom Beacon Domain
Notes:
Average Bitrate metrics available in v4.2.11 and newer.
1 Include the Mux Data SDK
Mux supports Chromecast applications that are built on top of the Cast Application Framework CAF Receiver SDK. The CAF Receiver SDK supports the following streaming protocols.
A Chromecast application contains two main components: a sender and a receiver. The Mux Data SDK is integrated at the receiver side; include the chromecast-mux.js JavaScript file within your custom receiver application. You can use the Mux-hosted version of the script to receive automatic updates.
# example code here
2 Initialize Mux Data
Get your ENV_KEY from the Mux environments dashboard.
ENV_KEY is a client-side key used for Mux Data monitoring. To monitor video playback within your Chromecast application, pass the PlayerManager instance to initChromecastMux along with SDK options and metadata.
# example code here
3 Make your data actionable
Options are provided via the data object passed in the call to initChromecastMux. All metadata details except for env_key are optional, however you'll be able to compare and see more interesting results as you include more details.
For more information, see the Metadata Guide.
4 Set or update metadata after initialization
In this case, you should omit the values when you first call initChromecastMux. Then, once you have the metadata, you can update the metadata with the updateData method.
# example code here
5 Changing the video
There are two cases where the underlying tracking of the video view need to be reset:
- New source: When you load a new source URL into an existing player.
- New program: When the program within a singular stream changes.
New source
If your application plays multiple videos back-to-back, you need to signal when a new video starts to the Mux SDK. This could be when the user selects a different video or the player advances to the next video in a playlist.
To signal the Mux SDK that a new view is starting, you will need to emit a videochange event along with metadata about the new video.
New program
If you emit a programchange event, this will remove all previous video data and reset all metrics for the video view, creating a new video view.
6 Advanced options
Customize error tracking behavior
Errors tracked by Mux are considered fatal, meaning they are the result of playback failures. By default, @mux/mux-data-chromecast will track errors emitted from the video element as fatal errors.
When triggering an error event, it is important to provide values for player_error_code and player_error_message.
# example code here
Error translator
If your player emits error events that are not fatal or are unclear, you might use an error translator.
# example code here
Disable automatic error tracking
You may want to consider turning off Mux's automatic error tracking completely by passing automaticErrorTracking: false in the configuration object.
# example code here
Customize beacon collection domain
If you have integrated a custom domain for Data collection, specify your custom domain by setting beaconCollectionDomain.
# example code here
Destroying the Monitor
When you want to stop monitoring playback within a player, make sure to destroy the monitor by calling playerManager.mux.destroy().
Release notes
Current release
v4.16.29
- Update mux-embed to 5.18.2
Previous releases
- v4.16.28: Set viewer_connection_type, viewer_connection_low_data_mode with new networkchange event.
- v4.16.27: [chore] force upgrade of yarn to 4.12.0.