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

    Class Subscriber

    Packs remote media streams. Participants automatically receive them when others publish their streams. Initialized with Session.subscribe method

    See available event listeners at StreamManagerEventMap.

    Hierarchy (View Summary)

    Index

    Properties

    id: string

    id attribute of the DOM video element displaying the Publisher/Subscriber's stream. This property is only defined if:

    remote: boolean

    Whether the Stream represented in the DOM is local or remote

    stream: Stream

    The Stream represented in the DOM by the Publisher/Subscriber

    targetElement: HTMLElement

    The DOM HTMLElement assigned as target element when creating the video for the Publisher/Subscriber. This property is only defined if:

    videos: StreamManagerVideo[] = []

    All the videos displaying the Stream of this Publisher/Subscriber

    Methods

    • Makes video element parameter display this stream. This is useful when you are managing the video elements on your own

      Calling this method with a video already added to other Publisher/Subscriber will cause the video element to be disassociated from that previous Publisher/Subscriber and to be associated to this one.

      Parameters

      • video: HTMLVideoElement

      Returns number

      1 if the video wasn't associated to any other Publisher/Subscriber and has been successfully added to this one. 0 if the video was already added to this Publisher/Subscriber. -1 if the video was previously associated to any other Publisher/Subscriber and has been successfully disassociated from that one and properly added to this one.

    • Creates a new video element displaying this stream. This allows you to have multiple video elements displaying the same media stream.

      The Publisher/Subscriber object will dispatch a videoElementCreated event once the HTML video element has been added to DOM. See VideoElementEvent

      Parameters

      • OptionaltargetElement: string | HTMLElement

        HTML DOM element (or its id attribute) in which the video element of the Publisher/Subscriber will be inserted

      • OptionalinsertMode: VideoInsertMode

        How the video element will be inserted accordingly to targetElemet

      Returns HTMLVideoElement

      The created HTMLVideoElement

    • Subscribe or unsubscribe from the audio stream (if available). Calling this method twice in a row passing same value will have no effect

      Parameters

      • value: boolean

        true to subscribe to the audio stream, false to unsubscribe from it

      Returns Subscriber

    • Subscribe or unsubscribe from the video stream (if available). Calling this method twice in a row passing same value will have no effect

      Parameters

      • value: boolean

        true to subscribe to the video stream, false to unsubscribe from it

      Returns Subscriber

    • Updates the current configuration for the PublisherSpeakingEvent feature and the StreamManagerEvent.streamAudioVolumeChange feature for this specific StreamManager audio stream, overriding the global options set with OpenVidu.setAdvancedConfiguration. This way you can customize the audio events options for each specific StreamManager and change them dynamically.

      Parameters

      • publisherSpeakingEventsOptions: { interval?: number; threshold?: number }

        New options to be applied to this StreamManager's audio stream. It is an object which includes the following optional properties:

        • interval: (number) how frequently the analyser polls the audio stream to check if speaking has started/stopped or audio volume has changed. Default 100 (ms)
        • threshold: (number) the volume at which publisherStartSpeaking, publisherStopSpeaking events will be fired. Default -50 (dB)

      Returns void