Skip to main content

index/functions/getRecordingAssetUrl.md

getRecordingAssetUrl(tokenName, recordingId, assetType, baseUrl, extension?): string

Get redirect URL for a generic recording asset

Low-level utility for generating recording asset URLs when the specific helper functions don't meet your needs. Combines token name, recording ID, asset type, and extension.

Parameters​

ParameterTypeDescription
tokenNamestringToken name (lowercase)
recordingIdstringRecording asset ID (from Mux)
assetTypestringAsset type name (e.g., 'thumbnail', 'stream', 'storyboard')
baseUrlstringAPI base URL
extension?stringOptional file extension (no default, must be provided if needed)

Returns​

string

Full redirect URL to recording asset

Throws​

Error if token name or recording ID is invalid, asset type is empty, or extension format is incorrect

Example​

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

// With extension (for custom formats)
const customUrl = getRecordingAssetUrl(
'anime',
'asset_abc123',
'metadata',
'https://api.example.com',
'json'
);
// → "https://api.example.com/v1/tokens/anime/recordings/asset_abc123/assets/metadata.json"

Since​

7.3.0