Skip to content
This repository was archived by the owner on Nov 25, 2022. It is now read-only.
This repository was archived by the owner on Nov 25, 2022. It is now read-only.

Option to mute microphone of the publisher through a button #232

@prabhat13528

Description

@prabhat13528

Currently, I can hover over the video and mute the mic but is there any other way to access the function/method to mute the microphone through a button?

I am using the window.OT.initsession to create the session and the below code is used to create the publisher stream:

this.sessionHelper = createSessionHelper({
      apiKey: session.apiKey,
      sessionId: session.sessionId,
      token: session.token,
      onStreamsUpdated: (streams) => {
        this.setState({ streams });
      },
      onConnect: function () {
        setTimeout(function () {
          const publisherOptions = {
            frameRate: 15,
            resolution: "1280x720",
            showControls: true,
            facingMode: "environment",
            fitMode: "contain",
            height: "100%",
            width: "100%",
            mirror: false,
            publishAudio: me.state.demo,
          };
          me.publisherHelper = new Publisher();
          me.publisherHelper
            .publish(publisherOptions, null, true)
            .then(function publishThen(publisher) {
              me.sessionHelper.session.publish(publisher, me.handleError);
              me.publisher = publisher;
            })
            .catch(me.handleError);
        }, 100);
      },
      onIncomingSignal: function (data) {
        me.handleIncomingSignal(data);
      },
    });

I know that the publishAudio can be used to mute but once the publisher stream has started, changing the state variable it's being assigned to doesn't update the publisher property.

Is there any way to update the publisher property once the stream is published or access the mute method/function outside of the video?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions