Skip to main content

index/functions/getRecordingStreamUrl.md

getRecordingStreamUrl(tokenName, recordingId, baseUrl): string

Get redirect URL for a recording HLS stream

HTTP Live Streaming (HLS) playlist for recorded video playback. Returns the master playlist (.m3u8) that references variant streams at different bitrates.

Backend: Redirects to Mux HLS master playlist for the recording.

Parameters​

ParameterTypeDescription
tokenNamestringToken name (lowercase)
recordingIdstringRecording asset ID (from Mux)
baseUrlstringAPI base URL

Returns​

string

Full redirect URL to HLS playlist

Throws​

Error if token name or recording ID is invalid

Example​

const streamUrl = getRecordingStreamUrl(
'anime',
'asset_abc123',
'https://api.example.com'
);
// → "https://api.example.com/v1/tokens/anime/recordings/asset_abc123/assets/stream.m3u8"

// Use with video player
const videoElement = document.querySelector('video');
if (videoElement) {
// HLS.js or native HLS support
if (videoElement.canPlayType('application/vnd.apple.mpegurl')) {
videoElement.src = streamUrl;
} else {
// Fallback to HLS.js
}
}

Since​

7.3.0