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

    Class Source

    Index

    Accessors

    • get isMuted(): boolean

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

      Returns boolean

    • get mediaStream(): MediaStream

      The actual audio / video stream.

      Returns MediaStream

    Methods

    • Gets if the remote source 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 { Publisher, Room, Source } from '@millicast/sdk-interactivity';

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

      room.on('sourceAdded', async (publisher: Publisher, source: Source) => {
      // Request to receive the source
      await source.receive();

      // Display the source on the UI
      const videoElement = document.getElementById('remote-video');
      videoElement.srcObject = new MediaStream([source.videoTrack]);
      videoElement.play();

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

      await room.watch();
    • Mutes the audio track.

      Returns void

    • Request to start receiving the source.

      Returns Promise<void>

    • Stop receiving the source.

      Returns Promise<void>

    • Unmutes the audio track.

      Returns void