This example is a standard WHEPClient subscribe flow with an additional standby control shown after subscribe starts.
Standby mode lets the subscriber signal the server to pause or resume media delivery (audio/video) without ending the subscription session.
- normal WHEP subscribe lifecycle (
init,subscribe,unsubscribe) - post-subscribe standby controls in the UI
- signaling standby on/off through the WHEP standby API
- subscriber/status UI updates while staying connected
After subscribe is active, the example toggles:
subscriber.enableStandby()to request standby modesubscriber.disableStandby()to resume media delivery
Conceptually:
- Standby enabled: server pauses sending media tracks to this subscriber
- Standby disabled: server resumes sending media tracks
This is distinct from unsubscribe/subscribe, because session state remains active while media delivery is paused/resumed.
- Start subscribe as usual.
- On
Subscribe.Start, reveal the standby section. - User clicks Enable Standby / Disable Standby toggle.
- Call standby API method and update local standby state/status text.
- On subscribe stop/failure, reset standby UI/state.
const subscriber = new red5prosdk.WHEPClient()
await subscriber.init({
endpoint,
streamName,
mediaElementId: 'subscriber-video',
connectionParams,
})
await subscriber.subscribe()
// Pause delivery
subscriber.enableStandby()
// Resume delivery
subscriber.disableStandby()Standby signaling is independent from deployment mode. Endpoint and connectionParams setup follows the same WHEP pattern as other subscriber examples.
const endpoint = `https://${host}:443/live/whep/${streamName}`
const connectionParams = {}const endpoint = `https://${host}/as/v1/proxy/whep/${app}/${streamName}`
const connectionParams = {
// e.g. region, nodeGroup, auth metadata
}- standby toggle action:
toggleStandby() - standby UI state sync:
syncStandbyControls()andsyncStandbySection() - subscribe lifecycle + standby reset:
startSubscribe()/stopSubscribe() - subscriber event handling:
onSubscriberEvent()
Use this example as the reference pattern when you need subscriber-controlled pause/resume of server media delivery without tearing down the WHEP connection.