# muxinc/media-elements architecture

> Architecture diagram of the GitHub repository muxinc/media-elements, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/muxinc/media-elements
- Repository: https://github.com/muxinc/media-elements

## Overview

media-elements is a collection of HTMLMediaElement-compatible custom elements and add-ons. The principal workflow is that a page uses a media element to present or control media through a native, streaming, or third-party player; optional add-ons provide track/rendition APIs, played-range behavior, and casting. The README documents the product capabilities and integrations, while the sampled source shows internals for casting and media tracks. Other adapters are represented from their tree paths and README descriptions; their internal call relationships were not sampled.

Main entry points: [`packages/castable-video/castable-mixin.js`](https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-mixin.js) (Cast mixin), [`packages/castable-video/castable-remote-playback.js`](https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-remote-playback.js) (Remote playback), [`packages/media-tracks/src/mixin.ts`](https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/mixin.ts) (Track mixin), [`packages/custom-media-element/custom-media-element.ts`](https://github.com/muxinc/media-elements/blob/main/packages/custom-media-element/custom-media-element.ts) (Custom media)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundation["Media foundations"]
  node_custom["Custom media"]
  node_super["Super media"]
end

subgraph group_playback["Playback elements"]
  node_hls["HLS video"]
  node_dash["DASH video"]
  node_shaka["Shaka video"]
end

subgraph group_providers["Provider integrations"]
  node_cloudflare["Cloudflare video"]
  node_peertube["PeerTube video"]
  node_youtube["YouTube video"]
  node_tiktok["TikTok video"]
  node_vimeo["Vimeo video"]
  node_videojs["Video.js video"]
  node_jwplayer["JW Player video"]
  node_twitch["Twitch video"]
  node_wistia["Wistia video"]
  node_spotify["Spotify audio"]
end

subgraph group_addons["Media add-ons"]
  node_tracks["Tracks and renditions"]
  node_trackmixin["Track mixin<br/>[mixin.ts]"]
  node_tracklists["Track lists"]
  node_trackmodels["Track models<br/>[video-track.ts]"]
  node_renditionlists["Rendition lists"]
  node_renditionmodels["Rendition models<br/>[audio-rendition.ts]"]
  node_played["Played ranges<br/>[index.js]"]
end

subgraph group_casting["Casting"]
  node_castmixin["Cast mixin<br/>[castable-mixin.js]"]
  node_remote["Remote playback"]
  node_castutils["Cast utilities<br/>[castable-utils.js]"]
end

node_page(("Web page"))
node_chromecast(("Cast receiver"))
node_hlsjs(("hls.js"))
node_dashjs(("dash.js"))
node_shakaplayer(("Shaka Player"))
node_youtubeplatform(("YouTube player"))
node_tiktokplatform(("TikTok player"))
node_vimeoplatform(("Vimeo player"))
node_videojsplatform(("Video.js"))

node_page -->|"uses"| node_custom
node_page -->|"uses"| node_super
node_page -->|"uses"| node_tracks
node_page -.->|"uses"| node_played
node_page -->|"uses"| node_castmixin
node_page -->|"uses"| node_hls
node_page -->|"uses"| node_dash
node_page -->|"uses"| node_shaka
node_page -->|"uses"| node_cloudflare
node_page -->|"uses"| node_peertube
node_page -->|"uses"| node_youtube
node_page -->|"uses"| node_tiktok
node_page -->|"uses"| node_vimeo
node_page -->|"uses"| node_videojs
node_page -->|"uses"| node_jwplayer
node_page -->|"uses"| node_twitch
node_page -->|"uses"| node_wistia
node_page -->|"uses"| node_spotify
node_custom -.->|"extends native media"| node_super
node_castmixin -->|"creates"| node_remote
node_castmixin -->|"calls"| node_castutils
node_remote -->|"calls"| node_castutils
node_remote -.->|"controls playback"| node_chromecast
node_hls -->|"integrates"| node_hlsjs
node_dash -->|"integrates"| node_dashjs
node_shaka -->|"integrates"| node_shakaplayer
node_youtube -->|"integrates"| node_youtubeplatform
node_tiktok -->|"integrates"| node_tiktokplatform
node_vimeo -->|"integrates"| node_vimeoplatform
node_videojs -->|"integrates"| node_videojsplatform
node_trackmixin -->|"manages"| node_tracklists
node_trackmixin -->|"creates"| node_trackmodels
node_trackmodels -->|"adds renditions"| node_renditionlists
node_renditionlists -.->|"uses"| node_renditionmodels

click node_custom "https://github.com/muxinc/media-elements/blob/main/packages/custom-media-element/custom-media-element.ts"
click node_super "https://github.com/muxinc/media-elements/blob/main/packages/super-media-element/super-media-element.js"
click node_tracks "https://github.com/muxinc/media-elements/tree/main/packages/media-tracks/src"
click node_trackmixin "https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/mixin.ts"
click node_tracklists "https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/video-track-list.ts"
click node_trackmodels "https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/video-track.ts"
click node_renditionlists "https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/video-rendition-list.ts"
click node_renditionmodels "https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/audio-rendition.ts"
click node_played "https://github.com/muxinc/media-elements/blob/main/packages/media-played-ranges-mixin/index.js"
click node_castmixin "https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-mixin.js"
click node_remote "https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-remote-playback.js"
click node_castutils "https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-utils.js"
click node_hls "https://github.com/muxinc/media-elements/blob/main/packages/hls-video-element/hls-video-element.js"
click node_dash "https://github.com/muxinc/media-elements/blob/main/packages/dash-video-element/dash-video-element.js"
click node_shaka "https://github.com/muxinc/media-elements/blob/main/packages/shaka-video-element/shaka-video-element.js"
click node_cloudflare "https://github.com/muxinc/media-elements/blob/main/packages/cloudflare-video-element/cloudflare-video-element.js"
click node_peertube "https://github.com/muxinc/media-elements/blob/main/packages/peertube-video-element/peertube-video-element.js"
click node_youtube "https://github.com/muxinc/media-elements/blob/main/packages/youtube-video-element/youtube-video-element.js"
click node_tiktok "https://github.com/muxinc/media-elements/blob/main/packages/tiktok-video-element/tiktok-video-element.js"
click node_vimeo "https://github.com/muxinc/media-elements/blob/main/packages/vimeo-video-element/vimeo-video-element.js"
click node_videojs "https://github.com/muxinc/media-elements/blob/main/packages/videojs-video-element/videojs-video-element.js"
click node_jwplayer "https://github.com/muxinc/media-elements/blob/main/packages/jwplayer-video-element/jwplayer-video-element.js"
click node_twitch "https://github.com/muxinc/media-elements/blob/main/packages/twitch-video-element/twitch-video-element.js"
click node_wistia "https://github.com/muxinc/media-elements/blob/main/packages/wistia-video-element/wistia-video-element.js"
click node_spotify "https://github.com/muxinc/media-elements/blob/main/packages/spotify-audio-element/spotify-audio-element.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_custom,node_super toneBlue
class node_hls,node_dash,node_shaka toneAmber
class node_cloudflare,node_peertube,node_youtube,node_tiktok,node_vimeo,node_videojs,node_jwplayer,node_twitch,node_wistia,node_spotify toneMint
class node_tracks,node_trackmixin,node_tracklists,node_trackmodels,node_renditionlists,node_renditionmodels,node_played toneRose
class node_castmixin,node_remote,node_castutils,node_page,node_chromecast,node_hlsjs,node_dashjs,node_shakaplayer,node_youtubeplatform,node_tiktokplatform,node_vimeoplatform,node_videojsplatform toneIndigo
```

## Components

### Media foundations

- [Custom media](https://github.com/muxinc/media-elements/blob/main/packages/custom-media-element/custom-media-element.ts): `packages/custom-media-element/custom-media-element.ts`
- [Super media](https://github.com/muxinc/media-elements/blob/main/packages/super-media-element/super-media-element.js): `packages/super-media-element/super-media-element.js`

### Playback elements

- [HLS video](https://github.com/muxinc/media-elements/blob/main/packages/hls-video-element/hls-video-element.js): `packages/hls-video-element/hls-video-element.js`
- [DASH video](https://github.com/muxinc/media-elements/blob/main/packages/dash-video-element/dash-video-element.js): `packages/dash-video-element/dash-video-element.js`
- [Shaka video](https://github.com/muxinc/media-elements/blob/main/packages/shaka-video-element/shaka-video-element.js): `packages/shaka-video-element/shaka-video-element.js`

### Provider integrations

- [Cloudflare video](https://github.com/muxinc/media-elements/blob/main/packages/cloudflare-video-element/cloudflare-video-element.js): `packages/cloudflare-video-element/cloudflare-video-element.js`
- [PeerTube video](https://github.com/muxinc/media-elements/blob/main/packages/peertube-video-element/peertube-video-element.js): `packages/peertube-video-element/peertube-video-element.js`
- [YouTube video](https://github.com/muxinc/media-elements/blob/main/packages/youtube-video-element/youtube-video-element.js): `packages/youtube-video-element/youtube-video-element.js`
- [TikTok video](https://github.com/muxinc/media-elements/blob/main/packages/tiktok-video-element/tiktok-video-element.js): `packages/tiktok-video-element/tiktok-video-element.js`
- [Vimeo video](https://github.com/muxinc/media-elements/blob/main/packages/vimeo-video-element/vimeo-video-element.js): `packages/vimeo-video-element/vimeo-video-element.js`
- [Video.js video](https://github.com/muxinc/media-elements/blob/main/packages/videojs-video-element/videojs-video-element.js): `packages/videojs-video-element/videojs-video-element.js`
- [JW Player video](https://github.com/muxinc/media-elements/blob/main/packages/jwplayer-video-element/jwplayer-video-element.js): `packages/jwplayer-video-element/jwplayer-video-element.js`
- [Twitch video](https://github.com/muxinc/media-elements/blob/main/packages/twitch-video-element/twitch-video-element.js): `packages/twitch-video-element/twitch-video-element.js`
- [Wistia video](https://github.com/muxinc/media-elements/blob/main/packages/wistia-video-element/wistia-video-element.js): `packages/wistia-video-element/wistia-video-element.js`
- [Spotify audio](https://github.com/muxinc/media-elements/blob/main/packages/spotify-audio-element/spotify-audio-element.js): `packages/spotify-audio-element/spotify-audio-element.js`

### Media add-ons

- [Tracks and renditions](https://github.com/muxinc/media-elements/tree/main/packages/media-tracks/src): `packages/media-tracks/src`
- [Track mixin](https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/mixin.ts): `packages/media-tracks/src/mixin.ts`
- [Track lists](https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/video-track-list.ts): `packages/media-tracks/src/video-track-list.ts`
- [Track models](https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/video-track.ts): `packages/media-tracks/src/video-track.ts`
- [Rendition lists](https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/video-rendition-list.ts): `packages/media-tracks/src/video-rendition-list.ts`
- [Rendition models](https://github.com/muxinc/media-elements/blob/main/packages/media-tracks/src/audio-rendition.ts): `packages/media-tracks/src/audio-rendition.ts`
- [Played ranges](https://github.com/muxinc/media-elements/blob/main/packages/media-played-ranges-mixin/index.js): `packages/media-played-ranges-mixin/index.js`

### Casting

- [Cast mixin](https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-mixin.js): `packages/castable-video/castable-mixin.js`
- [Remote playback](https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-remote-playback.js): `packages/castable-video/castable-remote-playback.js`
- [Cast utilities](https://github.com/muxinc/media-elements/blob/main/packages/castable-video/castable-utils.js): `packages/castable-video/castable-utils.js`

### Other components

- **Web page**
- **Cast receiver**
- **hls.js**
- **dash.js**
- **Shaka Player**
- **YouTube player**
- **TikTok player**
- **Vimeo player**
- **Video.js**

## Connections

- Web page → Custom media: uses
- Web page → Super media: uses
- Web page → Tracks and renditions: uses
- Web page → Played ranges: uses
- Web page → Cast mixin: uses
- Web page → HLS video: uses
- Web page → DASH video: uses
- Web page → Shaka video: uses
- Web page → Cloudflare video: uses
- Web page → PeerTube video: uses
- Web page → YouTube video: uses
- Web page → TikTok video: uses
- Web page → Vimeo video: uses
- Web page → Video.js video: uses
- Web page → JW Player video: uses
- Web page → Twitch video: uses
- Web page → Wistia video: uses
- Web page → Spotify audio: uses
- Custom media → Super media: extends native media
- Cast mixin → Remote playback: creates (evidence: `packages/castable-video/castable-mixin.js`)
- Cast mixin → Cast utilities: calls (evidence: `packages/castable-video/castable-mixin.js`)
- Remote playback → Cast utilities: calls (evidence: `packages/castable-video/castable-remote-playback.js`)
- Remote playback → Cast receiver: controls playback
- HLS video → hls.js: integrates
- DASH video → dash.js: integrates
- Shaka video → Shaka Player: integrates
- YouTube video → YouTube player: integrates
- TikTok video → TikTok player: integrates
- Vimeo video → Vimeo player: integrates
- Video.js video → Video.js: integrates
- Track mixin → Track lists: manages (evidence: `packages/media-tracks/src/mixin.ts`)
- Track mixin → Track models: creates (evidence: `packages/media-tracks/src/mixin.ts`)
- Track models → Rendition lists: adds renditions (evidence: `packages/media-tracks/src/video-track.ts`)
- Rendition lists → Rendition models: uses
