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

Could not change audio input/output and video input #65

Closed
KASOGIT opened this issue Apr 23, 2019 · 1 comment
Closed

Could not change audio input/output and video input #65

KASOGIT opened this issue Apr 23, 2019 · 1 comment

Comments

@KASOGIT
Copy link

KASOGIT commented Apr 23, 2019

Hi 👋
I would like to swap the audio input output (headset) used for the call as well as the video one (multiple camera) but i don't think i can do it actually or maybe i didn't find how ?
So far i just found how to activate/deactivate them or swap between camera and screen sharing.

Best regards.

@msach22
Copy link
Contributor

msach22 commented May 10, 2019

You can adjust the audio source by doing something like this:
https://tokbox.com/developer/guides/audio-video/js/#setAudioSource

For switching between multiple cameras, you can use the cycleVideo function: https://tokbox.com/developer/guides/audio-video/js/#cycleVideo

Using React, you will need to create a Ref to the OTPublisher instance and call getPublisher so you can get the OpenTok publisher instance.

Here's an example on how to use cycleVideo:

class MyComponent extends Component {
  constructor(props) {
    super(props);
    this.otPublisher = React.createRef();
  }
  cycleVideo = () => { 
   if (this.otPublisher) { 
    publisher = this.otPublisher.current.getPublisher();
    publisher.cycleVideo().then().catch() // implement custom logic here
   } 
  } 
  render() {
    return ( 
      <div>
        <OTPublisher ref={this.otPublisher} />;
        <button onClick={this.cycleVideo}> Cycle Video </button>
      </div>
    )
  }
}

@msach22 msach22 closed this as completed May 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants