Interactivity SDK - v0.3.0
    Preparing search index...

    Class PublishedSource

    Represents a published source.

    Index

    Accessors

    • get audioTrack(): MediaStreamTrack

      Gets the audio track.

      Returns MediaStreamTrack

    • get isMuted(): boolean

      Gets if the audio track is muted or not. If no audio track is available, this returns true.

      Returns boolean

    • get publisher(): Publish

      Gets the Millicast Publish object used to publish the source to the stream.

      Returns Publish

    • get videoTrack(): MediaStreamTrack

      Gets the video track.

      Returns MediaStreamTrack

    Methods

    • Gets if the publisher is considered to be speaking or not.

      Returns Promise<boolean>

      A Promise whose fulfillment handler receives a flag indicating if the publisher is considered to be speaking.

      import { Room } from '@millicast/sdk-interactivity';

      const room = new Room({
      streamName,
      streamAccountId,
      });

      const localSource = await room.connect({
      publishToken,
      publisherName,
      constraints: {
      audio: true,
      video: true,
      },
      });

      const videoElement = document.getElementById("local-video");
      videoElement.srcObject = new MediaStream([localSource.videoTrack]);
      videoElement.play();

      setInterval(async () => {
      const isSpeaking = await localSource.isSpeaking();
      console.log('is speaking', isSpeaking);
      }, 1000);