Closed julien-meichelbeck closed 5 years ago
@julien-meichelbeck The cycleVideo
method returns a promise so I recommend checking to see if the promise resolves or rejects. Please make sure you are running this on a device with multiple cameras.
I also recommend using the ref
prop to get access to the publisher. You can the getPublisher
method of the OTPublisher
component to get the publisher object like so:
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>
)
}
}
Hello, thank you for your answer.
returns a promise so I recommend checking to see if the promise resolves or rejects.
Yes, sure we can handle the promise, but it will not fix the issue.
Please make sure you are running this on a device with multiple cameras.
Yes, this button is only displayed if there is more than one video device (following a navigator.mediaDevices.enumerateDevices
call).
I also recommend using the
ref
prop to get access to the publisher.
Thanks, this is looks better, but it doesn't actually fix anything, right ?
@julien-meichelbeck I believe the team had an offline chat with you about this and it was related to a specific device. I'm going to go ahead and close the issue, but please feel free to re-open if the issue still persists.
this issue was not closed brother msach22,still there are some glitches are pending like you know when we got and error from publisher.cycleVideo(),the current ot-publisher was gots disturbed and disappeared,if you some able to provide a solution if the promise returns catch block error then we are able use the current camera and providing some alert to user other device was being busy like wise ,if any dude implemented please do help me on this situation ,hope brother msach22 respond back with good solution for this,thanks in advance
@satyanarayanaAmzur If I understand correctly, you're saying that there's a glitch in the publisher even when there's an OT_HARDWARE_UNAVAILABLE error?
yes bro it was disappeared when we got an error,i mean the communication with current publisher was disturbed and publisher window was hidden from room
Sorry to revive this but I'm having the same issue with a oneplus 7 pro.
When i call cycleVideo I get this error, but for some reason on this demo site https://opentokdemo.tokbox.com/ it works without any problems.
Same error here on Galaxy A40 when trying to use cycleVideo. Works well on my iPhone. Could this be of any fix here?
FYI; It seems like by calling stream.getTracks().forEach(track => track.stop());
before changing video device (aka. calling cycleDevice()) it prevented the error and is now working :)
Can you confirm @BenRedmondBenham
Hi guys, I tried to reproduce using "@opentok/client": "^2.17.0"
and "opentok-react": "0.10.0"
and is working perfectly.
I am using VDF 900 phone with Android 6.0.1 and Chrome 80
@kulttuuri can you share the library version you're using?
I am using 2.17.0. I also tried with 2.15.0 to see if that is the problem. I believe that the issue only arises on some Android devices as the linked PR commit states.
@kulttuuri would mind trying on https://opentokdemo.tokbox.com/ with your Galaxy A40? 👍
Galaxy S20+ cycle video fails on the demo https://opentok.github.io/opentok-web-samples/Publish-Devices/ it also fails https://opentokdemo.tokbox.com/
@enricop89 Weird - Now both demos worked on my Android, I am certain that they did not in the last week.
am almost giving up on this ..am trying to pass the session,so that subscriber can also view ,but i dont seem to get it am kinda of new am learning
Hi, there is the same issue if we use Tokbox in Electron.js app on Mac. We use the 2.17.7 version of Tokbox JS API.
Same issue here
Sometimes, when calling
cycleVideo
, the OTPublisher unmounts and an error is thrown.Example:
Error :
This issue can be seen on Android and iOS.