View a comprehensive list of every attribute, slot, CSS part and variable, and event that can be used with Mux Player for Astro.
Mux Player for Web is in maintenance mode
Existing integrations keep working. Starting a new project? Use Video.js. Migrating? See the migration guide. To learn what maintenance mode means, see the FAQ.
| Prop | Type | Description | Default |
|---|---|---|---|
currentTime | number | Set initial playback position | 0 |
poster | string (URL) | Poster image URL | undefined |
playbackRate | number | Playback speed (1.0 = normal) | 1 |
autoplay | boolean | Auto-start playback | false |
loop | boolean | Loop the video | false |
playsInline | boolean | Play inline on mobile | false |
muted | boolean | Start muted | false |
audio | boolean | Enable audio-only mode | false |
primaryColor | string (Any valid CSS color style) | Primary UI color | undefined |
secondaryColor | string (Any valid CSS color style) | Secondary UI color | undefined |
accentColor | string (Any valid CSS color style) | Accent UI color | undefined |
playbackId | string | Mux playback ID for the video | undefined |
src | string (URL) | Direct video URL (alternative to playbackId) | undefined |
customDomain | string (domain name) | Custom domain for video delivery | undefined |
envKey | string | Environment key for Mux Data | undefined |
storyboardSrc | string (URL) | Custom storyboard/thumbnail track | undefined |
chapters | object | Chapter markers | undefined |
streamType | "on-demand" | "live" | "ll-live" | Type of stream ('on-demand', 'live', 'll-live') | "on-demand" |
targetLiveWindow | number | Live stream window duration | undefined |
maxResolution | string | Maximum playback resolution | undefined |
minResolution | string | Minimum playback resolution | undefined |
renditionOrder | string | Quality selection ordering | undefined |
metadata | object | Object with video_id, video_title, viewer_user_id | undefined |
tokens | object | Signed tokens for private videos | undefined |
proudlyDisplayMuxBadge | boolean | Show Mux badge | false |
theme | string | Player theme component | undefined |
initialBandwidthEstimateKbps | number | Initial bandwidth estimate (kbps) for HLS.js ABR | undefined |
initialEstimateSegments | number | Segments that use initial estimate before switching to measured bandwidth | undefined |
minPreloadSegments | number | Buffer this many segments before allowing playback | undefined |
Available themes:
classic - Classic player thememinimal - Minimal player thememicrovideo - Microvideo theme for short-form contentgerwig - P, pretty, I, intelligent, N, never sad, K, coolnews - News themeAlternatively you can use a Media Chrome theme by passing the theme name as a string and including the theme <template> element with that ID in your page:
---
import { MuxPlayer } from '@mux/mux-player-astro';
---
<template id="tiny-theme">
<media-controller>
<slot name="media" slot="media"></slot>
<media-control-bar>
<media-play-button></media-play-button>
</media-control-bar>
</media-controller>
</template>
<MuxPlayer
playbackId="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe"
theme="tiny-theme"
/>---
import { MuxPlayer } from '@mux/mux-player-astro';
---
<MuxPlayer
playbackId="your-audio-playback-id"
audio
metadata={{
video_title: 'My Podcast Episode',
}}
/>---
import { MuxPlayer } from '@mux/mux-player-astro';
---
<MuxPlayer
playbackId="your-live-playback-id"
streamType="live"
targetLiveWindow={Infinity}
title="Live Stream"
/>---
import { MuxPlayer } from '@mux/mux-player-astro';
---
<MuxPlayer
playbackId="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe"
primaryColor="#ff6b35"
secondaryColor="#ffffff"
accentColor="#0066cc"
/><MuxPlayer/> supports all standard media events. To add event listeners to the component you can use a client-side script. You can get the correct types for the player element by importing MuxPlayerElement from @mux/mux-player-astro and casting the element to that type.
---
import { MuxPlayer } from '@mux/mux-player-astro';
---
<MuxPlayer
id="my-player"
playbackId="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe"
/>
<script>
import type { MuxPlayerElement } from '@mux/mux-player-astro';
const player = document.getElementById('my-player') as MuxPlayerElement;
player.addEventListener('play', (event) => {
console.log('Player started playing!');
});
player.addEventListener('pause', (event) => {
console.log('Player paused!');
});
player.addEventListener('timeupdate', (event) => {
console.log('Current time: ', player.currentTime);
});
player.addEventListener('ended', (event) => {
console.log('Video ended!');
});
</script>| Event | Description |
|---|---|
abort | Identical to the native abort event |
canplay | Identical to the native canplay event |
canplaythrough | Identical to the native canplaythrough event |
durationchange | Identical to the native durationchange event |
emptied | Identical to the native emptied event |
ended | Identical to the native ended event |
error | Identical to the native error event |
loadeddata | Identical to the native loadeddata event |
loadedmetadata | Identical to the native loadedmetadata event |
loadstart | Identical to the native loadstart event |
pause | Identical to the native pause event |
play | Identical to the native play event |
playing | Identical to the native playing event |
progress | Identical to the native progress event |
ratechange | Identical to the native ratechange event |
resize | Identical to the native resize event |
seeked | Identical to the native seeked event |
seeking | Identical to the native seeking event |
stalled | Identical to the native stalled event |
suspend | Identical to the native suspend event |
timeupdate | Identical to the native timeupdate event |
volumechange | Identical to the native volumechange event |
waiting | Identical to the native waiting event |
cuepointchange | Similar to the native TextTrack cuechange event, only the event's detail will be the activeCuePoint |
chapterchange | Similar to the native TextTrack cuechange event, only the event's detail will be the activeChapter |
See mux-player's reference for a list of all available CSS variables.
See mux-player's reference for a list of all available CSS parts.
See mux-player's reference for a list of all available slots.