GuidePlayback
Monitor playback with Mux Data
Measure startup time, rebuffering, failures, and watch time by adding the Mux Data extension to a player
Mux Data measures playback quality: startup time, rebuffering, playback failures, and watch time. Add the Mux Data extension to a player and it monitors whichever media that player is playing:
Install the extension alongside the framework façade. The <mux-video> example also installs the Mux playback adapter:
Register the <mux-data> element by importing @videojs/html/extensions/mux-data.
That’s the whole setup for Mux-hosted playback — no environment key required. The extension renders nothing; place it inside the player, as a sibling of the media element.
Set the environment key
Mux Data needs to know which environment a view belongs to. For Mux-hosted playback it works that out on its own: the component reports the Mux playback ID as the view’s video_id, and Mux attributes the view to the environment that owns that playback ID.
Set envKey when you monitor a source Mux doesn’t host, like a self-hosted HLS or DASH stream. Find the key in the Mux dashboard:
An explicit key always wins, so set one to send Mux-hosted views to a specific environment.
How it works
The extension attaches to the media the player is using, not to a specific element type, so it monitors <mux-video>, <hlsjs-video>, <dash-video>, and the rest alike.
How much it reports depends on the engine playing the stream. Every media gets the playback metrics the media element itself can tell us. On top of that, the component recognizes hls.js and dash.js engines and hands them to the Mux Data SDK, which adds stream-level detail: rendition switches, segment request timing and throughput, and engine errors. Media with no JavaScript engine, like native HLS or a plain <video>, report the element-level metrics alone.
The video_id it reports is the Mux playback ID for streams served from stream.mux.com, and the source URL otherwise. Each view also gets a generated view_session_id. Override either through metadata.
Describe the view
Pass Mux Data metadata to label views with your own titles, viewer IDs, and custom dimensions. It’s an object, so it’s a property rather than an attribute:
Configuration
The <mux-data> reference lists every option: the metadata and software fields above, plus the beacon domain, cookie, debug, and SDK settings. Most options update the current view in place; changing MuxDataSdk, beaconCollectionDomain, debug, or disableCookies restarts monitoring, ending the current view and starting a new one.