Functions
getSrc
getSrc
is a utility function for parsing various types of playback information and converting them into a standardized format suitable for the Player.
Features
- Supports inputs like Livepeer playback info, Cloudflare stream data, Mux URLs, arrays of strings, and single strings
- Transforms into
Src[]
which contains essential playback information, along with supportive metadata like thumbnails and VTT files.
Functionality
Input Types
The function can process the following input types:
LivepeerPlaybackInfo
: Extracts the ‘source’ array from its ‘meta’ property from the playback info endpoint.LivepeerSource
orLivepeerSource[]
: Uses the source object(s) directly.CloudflareStreamData
: Retrieves the stream data from a Cloudflare stream data object.string[]
: Assumes each string as a URL and creates an array of Source objects.string
: Assumes the string is a URL and creates a single Source object.
Output Format
The output is an array of Src
objects or null
if the input is invalid or
empty.
Was this page helpful?