The EnxStream is a derived Class from EnxRtc. It handles all the Media Stream-related functions to initiate, configure, and transport Streams to EnableX Media Servers. It is also used for receiving Stream endpoints to be played.

References: AttributesMethodsEvents

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 muted.
  • videoMuted – Boolean. True if Video is muted.
  • attributes – videoFrameRate.

Methods

A categorized listing of Stream Handler methods is as given below:

Basics

  • init() – To initiate a local Stream for publishing in the Room.
  • close() – To close and stop publishing the local Stream.
  • play() – To play Video on EnableX Player in a given DOM ID.
  • stop() – To stop playing Video on EnableX Player.

Stream Information

  • getId() – To get Stream ID.
  • getAttributes() – To get all attributes of the Stream.
  • ifAudio() – To know if the stream has an Audio Track.
  • ifVideo() – To know if the stream has a Video Track.
  • ifData() – To know if the stream has Text Data.
  • ifScreen() – To know if the stream has Screen Share.
  • ifMedia() – To know if the stream has Audio, Video or Screen Share.

Stream Controls

  • setAttributes() – To update / set attributes of local Stream.
  • updateConfiguration() – To update bandwidth requirement for audio and video for local Stream.
  • muteAudio() – To mute audio of local Stream.
  • muteVideo() – To mute video of local Stream.
  • unmuteAudio() – To unmute audio of local Stream.
  • unmuteVideo() – To unmute video of local Stream.

Miscellaneous

  • sendData() – To send plain text data with the Stream.
  • getVideoFrameImage() – To take a Raw Image Snapshot of Stream into Canvas Object.
  • switchMicrophone() – To switch Audio source of local Stream to another Microphone connected to the device..
  • switchCamera() – To switch Video source of local Stream to another Camera connected to the device..

Events

Stream Controls

  • media-access-allowed – When access is granted to Camera and Microphone.
  • media-access-denied – When access is denied for Camera and Microphone.
  • stream-attributes-updated – When local Stream attributes are updated.

Explore Web SDK