OpenVidu Browser - v2.32.2
    Preparing search index...

    Class Stream

    Represents each one of the media streams available in OpenVidu Server for certain session. Each Publisher and Subscriber has an attribute of type Stream, as they give access to one of them (sending and receiving it, respectively)

    Index

    Properties

    audioActive: boolean

    Whether the stream has the audio track muted or unmuted. If hasAudio is false, this property is undefined

    This property may change if the Publisher publishing the stream calls Publisher.publishAudio. Whenever this happens a StreamPropertyChangedEvent will be dispatched by the Session object as well as by the affected Subscriber/Publisher object

    connection: Connection

    The Connection object that is publishing the stream

    creationTime: number

    Time when this stream was created in OpenVidu Server (UTC milliseconds). Depending on the owner of this stream:

    • Subscriber object: property creationTime is always defined
    • Publisher object: property creationTime is only defined after successful execution of Session.publish
    filter?: Filter

    WARNING: experimental option. This interface may change in the near future

    Filter applied to the Stream. You can apply filters by calling Stream.applyFilter, execute methods of the applied filter with Filter.execMethod and remove it with Stream.removeFilter. Be aware that the client calling this methods must have the necessary permissions: the token owned by the client must have been initialized with the appropriated allowedFilters array.

    frameRate?: number

    Frame rate of the video in frames per second. This property is only defined if the Publisher of the stream was initialized passing a frameRate property on OpenVidu.initPublisher method

    hasAudio: boolean

    Whether the stream has an audio track or not

    hasVideo: boolean

    Whether the stream has a video track or not

    streamId: string

    Unique identifier of the stream. If the stream belongs to a...

    • Subscriber object: property streamId is always defined
    • Publisher object: property streamId is only defined after successful execution of Session.publish
    streamManager: StreamManager

    StreamManager object (Publisher or Subscriber) in charge of displaying this stream in the DOM

    typeOfVideo?: "CAMERA" | "SCREEN" | "CUSTOM" | "IPCAM"

    Can be:

    • "CAMERA": when the video source comes from a webcam.
    • "SCREEN": when the video source comes from screen-sharing.
    • "CUSTOM": when PublisherProperties.videoSource has been initialized in the Publisher side with a custom MediaStreamTrack when calling OpenVidu.initPublisher).
    • "IPCAM": when the video source comes from an IP camera participant instead of a regular participant (see IP cameras).

    If hasVideo is false, this property is undefined

    videoActive: boolean

    Whether the stream has the video track muted or unmuted. If hasVideo is false, this property is undefined.

    This property may change if the Publisher publishing the stream calls Publisher.publishVideo. Whenever this happens a StreamPropertyChangedEvent will be dispatched by the Session object as well as by the affected Subscriber/Publisher object

    videoDimensions: { height: number; width: number }

    Width and height in pixels of the encoded video stream. If hasVideo is false, this property is undefined

    This property may change if the Publisher that is publishing:

    • If it is a mobile device, whenever the user rotates the device.
    • If it is screen-sharing, whenever the user changes the size of the captured window.

    Whenever this happens a StreamPropertyChangedEvent will be dispatched by the Session object as well as by the affected Subscriber/Publisher object

    Methods

    • Applies an audio/video filter to the stream.

      Parameters

      • type: string

        Type of filter applied. See Filter.type

      • options: Object

        Parameters used to initialize the filter. See Filter.options

      Returns Promise<Filter>

      A Promise (to which you can optionally subscribe to) that is resolved to the applied filter if success and rejected with an Error object if not

    • Recreates the media connection with the server. This entails the disposal of the previous RTCPeerConnection and the re-negotiation of a new one, that will apply the same properties.

      This method can be useful in those situations were there the media connection breaks and OpenVidu is not able to recover on its own for any kind of unanticipated reason (see Automatic reconnection).

      Returns Promise<void>

      A Promise (to which you can optionally subscribe to) that is resolved if the reconnection operation was successful and rejected with an Error object if not

    • Removes an audio/video filter previously applied.

      Returns Promise<void>

      A Promise (to which you can optionally subscribe to) that is resolved if the previously applied filter has been successfully removed and rejected with an Error object in other case