getIngest function is designed to handle multiple input types and
processes them into a unified WHIP URL format for the broadcast. It supports
inputs such as stream keys, URLs, Cloudflare stream data, Cloudflare URL data,
or Livepeer stream data.
Overview
Functionality
getIngest is crafted to facilitate the integration of different ingest sources
into the broadcast by providing a standardized output format.
Input Types
The function can process the following input types:ingest: The ingest information to be parsed.string: If the string is a valid URL (starting with http/https), it’s returned directly. If not, it’s treated as a stream key and a WHIP URL is constructed using a provided base URL.LivepeerStream: Extracts thestreamKeyand constructs a WHIP URL using the provided base URL from options.CloudflareStreamData: Retrieves the URL from the Cloudflare data object.
opts: Optional parameters including:baseUrl: The base URL used to construct a WHIP URL when a stream key is provided. Defaults to “https://playback.livepeer.studio/webrtc”.
Output Format
The output is a WHIP URL string ornull if the input is invalid, empty, or the
necessary information to construct a WHIP URL is not provided.
Usage
The function is typically used in scenarios where different types of ingest sources need to be parsed and provided to a broadcaster in a standardized WHIP URL format.Implementation
ingestInfo can be any supported type of ingest source
information. The function processes this input and returns a WHIP URL, which can
then be used by the broadcaster for media broadcasting.