Red5 Documentation

WHEPClient Subscriber Events

WHEPClient Events

The following events are specific to the WHEPClient:

Access Event Type Meaning
CONNECT_SUCCESS ‘Connect.Success’ When the subscriber has established a required remote connection, such as to a WebSocket server.
CONNECT_FAILURE ‘Connect.Failure’ When the subscriber has failed to establish a required remote connection for consuming a stream.
SUBSCRIBE_START ‘Subscribe.Start’ When the subscriber has started a subscribing to a stream.
SUBSCRIBE_STOP ‘Subscribe.Stop’ When the subscriber has successfully closed an active subscription to a stream.
SUBSCRIBE_METADATA ‘Subscribe.Metadata’ When metadata is received on the client from the server.
VIDEO_DIMENSIONS_CHANGE ‘Subscribe.VideoDimensions.Change’ Invoked when video element has loaded metadata and the incoming stream dimensions are available.
ORIENTATION_CHANGE ‘Subscribe.Orientation.Change’ Invoked when an orientation change is detected in metadata. Mobile (iOS and Android) broadcasts are sent with an orientation.
STREAMING_MODE_CHANGE ‘Subscribe.StreamingMode.Change’ Invoked when the broadcast has “muted” either or both their video and audio tracks.
VOLUME_CHANGE ‘Subscribe.Volume.Change’ Invoked when a change to volume is detected during playback. From 0 to 1.
PLAYBACK_TIME_UPDATE ‘Subscribe.Time.Update’ Invoked when a change in playhead time is detected during playback. In seconds.
PLAYBACK_STATE_CHANGE ‘Subscribe.Playback.Change’ Invoked when a change in playback state has occured, such as when going from a Playback.PAUSED state to Playback.PLAYING state.
FULL_SCREEN_STATE_CHANGE ‘Subscribe.FullScreen.Change’ Invoked when a change in fullscreen state occurs during playback.
AUTO_PLAYBACK_FAILURE ‘Subscribe.Autoplay.Failure’ Invoked when an attempt to autoplay on a media element throws a browser exception; typically due to browser security restrictions and their autoplay policies. (WebRTC and HLS, only) See section on Autoplay Restrictions
AUTO_PLAYBACK_MUTED ‘Subscribe.Autoplay.Muted’ Invoked when an attempt to autoplay on a media element throws a browser exception and is muted based on the muteOnAutoplayRestriction config property; typically due to browser security restrictions and their autoplay policies. (WebRTC and HLS, only) See section on Autoplay Restrictions

In addition to the above events, the following events are also dispatched from a WHEPClient and are defined on the RTCSubscriberEventTypes enum:

Access Event Type Meaning
PEER_CONNECTION_AVAILABLE ‘WebRTC.PeerConnection.Available’ When the negotation process has produced a valid PeerConnection.
OFFER_START ‘WebRTC.Offer.Start’ When the subscriber requests to start an offer on the PeerConnection.
OFFER_END ‘WebRTC.Offer.End’ When the subscriber has received a SessionDescription from a requested offer over the PeerConnection.
ANSWER_START ‘WebRTC.Answer.Start’ When the subscriber requests to send an answer on the PeerConnection.
ANSWER_END ‘WebRTC.Answer.End’ When the subscriber has received an answer (in form of a MediaStream) over the PeerConnection.
CANDIDATE_CREATE ‘WebRTC.Candidate.Create’ When the subscriber requests to send a candidate on the PeerConnection.
CANDIDATE_RECEIVE ‘WebRTC.Candidate.Receive’ When the subscriber has received a candidate over the PeerConnection.
ICE_TRICKLE_COMPLETE ‘WebRTC.IceTrickle.Complete’ When the negotaiton process (a.k.a. trickle) has completed and the subscriber will attempt at consuming a stream.
ON_ADD_STREAM ‘WebRTC.Add.Stream’ When a MediaStream object has become available for playback.
TRACK_ADDED ‘WebRTC.PeerConnection.OnTrack’ When a MediaTrack has become available on the underlying RTCPeerConnection.
DATA_CHANNEL_AVAILABLE ‘WebRTC.DataChannel.Available’ the underlying RTCDataChannel is available when includeDataChannel configuration is used.
DATA_CHANNEL_OPEN ‘WebRTC.DataChannel.Open’ When the underlying RTCDataChannel is opened when signalingServerOnly configuration is used.
DATA_CHANNEL_CLOSE ‘WebRTC.DataChannel.Close’ When the underlying RTCDataChannel is closed when includeDataChannel configuration is used.
DATA_CHANNEL_ERROR ‘WebRTC.DataChannel.Error’ When an error has occurred within the underlying RTCDataChannel when includeDataChannel configuration is used.
DATA_CHANNEL_MESSAGE ‘WebRTC.DataChannel.Message’ When a message has been delivered over the underlying RTCDataChannel when includeDataChannel configuration is used.
HOST_ENDPOINT_CHANGED ‘WebRTC.Endpoint.Changed’ Notification when the endpoint on which to signal and stream from has been asigned.
SUBSCRIBE_STREAM_SWITCH ‘WebRTC.Subscribe.StreamSwitch’ Notification when request to switch stream on the connection is completed.
STATS_REPORT ‘WebRTC.Stats.Report’ Notification of a statistics report generated from the stream connection. Statistics are only reported based on the availability of stats on the init configuration or after calling monitorStats.