The EnxStream is a derived Class from EnxRtc. It handles all the Media Stream-related functions to initiate, configure, and transport Streams to the Portal Media Servers. It is also used for receiving Stream endpoints to be played.
References: Attributes – Methods – Observers
Private Attributes
id
– Unique Stream ID.local
– Boolean. True for Local Stream, False for Remote Stream.room
– JSON Object. Room with which the Stream is associated.showing
– Boolean. Whether the stream is being played.audio
– Boolean. True if the stream carries Audio Track.video
– Boolean. True if the stream carries Video Track.screen
– Boolean. True if the stream carries Screen Share.videoSize
– Size of Video Frame, defined as [minWidth, minHeight, maxWidth, maxHeight].videoFrameRate
– Frame Rate of Video Stream, defined as [min, max].desktopStreamId
– Chrome Media Source ID to be used for Screen Share.extensionId
– Extension ID to be used for Screen Share.audioMuted
– Boolean. True if Audio is mutedvideoMuted
– Boolean. True if Video is mutedattributes
– videoFrameRate
Methods
A categorized listing of Stream Handler methods is as given below:
Stream Information
getId()
– To get Stream ID.getAttributes()
– To get all attributes of the Stream.
– To get Audio and Video tracks.getMedia()
– To get the current state of the Stream.getState()
hasAudio()
– To know if the Stream has an Audio track.hasVideo()
– To know if the Stream has a Video track.hasData()
– To know if the Stream has Text Data.hasScreen()
– To know if the Stream has Screen Share.ifLocal()
– To know if the Stream is a Local Stream.isAudioActive()
– To know if the Audio Track is currently active.isVideoActive()
– To know if the Video Track is currently active.getLocalStream()
– To initialize a local stream at the Client endpoint before it can be published to the Room.
Stream Controls
muteSelfAudio()
– To mute/unmute audio of the Local Stream.muteSelfVideo()
– To mute/unmute video of the Local Stream.switchCamera()
– To switch the Stream source from rear to front Camera or vice-versa.updateConfiguration()
– To reconfigure a Stream by adding new or updating existing attributes of the Stream.
Moderator Controls
hardMuteAudio()
– To hard-mute a Participant’s audio.hardMuteVideo()
– To hard-mute a Participant’s video.hardUnMuteAudio()
– To lift the audio hard-mute restriction from the Participant.hardUnmuteVideo()
– To lift the video hard-mute restriction from the Participant.
Play Stream
attachRenderer()
– To attach a Stream to the PlayerView.detachRenderer()
– To detach a Stream from the PlayerView.
Observers & their Callbacks
Stream Observer
Given below is a category-wise listing of Stream Observer Callbacks based on their functions. The Room Observer is initiated along with Room Initialization Process.
Streaming
onRemoteStreamAudioMute()
– Notification to everyone in the Room when a user’s audio is muted.onRemoteStreamAudioUnMute()
– Notification to everyone in the Room when a user’s audio is unmuted.onAudioEvent()
– Notification to the stream publisher when the Audio track is muted/unmuted.onVideoEvent()
– Notification to the stream publisher when the Video track is muted/unmuted.
Messaging
onReceivedData()
– When text messages are received.
Hard Mute Audio Observer
Observer: EnxStream.setMuteAudioStreamObserver(EnxMuteAudioStreamObserver-Object)
– To receive the following callbacks:
onHardMutedAudio
– Acknowledgment to the Moderator when the Participant’s Audio Stream is hard-muted.onHardUnMutedAudio
– Acknowledgment to the Moderator when the hard-mute restriction is lifted from the Participant’s Audio Stream.onReceivedHardMuteAudio
– Notification to the Participant when the Moderator hard-mutes their Audio Stream.onReceivedHardUnMuteAudio
– Notification to the Participant when the Moderator lifts the hard-mute restriction from their Audio Stream.
Hard Mute Video Observer
Observer: EnxStream.setMuteVideoStreamObserver(EnxMuteVideoStreamObserver-Object)
– To receive the following callbacks:
onHardMutedVideo
– Acknowledgment to the Moderator when the Participant’s Video Stream is hard-muted.onHardUnMutedVideo
– Acknowledgment to the Moderator when the hard-mute restriction is lifted from the Participant’s Video Stream.onReceivedHardMuteVideo
– Notification to the Participant when the Moderator hard-mutes their Video Stream.onReceivedHardUnMuteVideo
– Notification to the Participant when the Moderator lifts the hard-mute restriction from their Video Stream.