Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
prabhat13528 opened this issue Jun 28, 2022 · 1 comment
Closed

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

prabhat13528 opened this issue Jun 28, 2022 · 1 comment

Comments

@prabhat13528
Copy link

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?

@prabhat13528
Copy link
Author

Created incorrectly. Needed to post it on opentok-react: https://github.com/opentok/opentok-react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant