Hi
I love open vidu, but i’m having a strange issue. I have followed this: OpenVidu Docs
I loaded up on my iphone, and after getting the tracks array there is only showing up, my iphone has 2 cameras.
Can i please get some help on switching cameras? Here is the basic code i am using to detect the tracks and do switch on button press:
OVSession.connect(token).then(() => {
OVUserMedia = OV.getUserMedia({
audioSource: false
}).then(mediaStream => {
OVVideoTracks = mediaStream.getVideoTracks();
console.log("MEDIA STREAM",mediaStream);
});
console.log("USER MEDIA",OVUserMedia)
OVPublisher = OV.initPublisher("publisher-video");
OVSession.publish(OVPublisher);
}).catch(error =>{
alert('There was an error connecting to the session: ’ + error.message);
})
OVVideoTracks has only got 1element in it instead of two?
Also, when i actually tell it to switch the track to index 0, the video just goes black?
OVPublisher.replaceTrack(OVVideoTracks[0]).then(() => {
console.log(“SWITCHED TRACK”);
//OVCurrentCamera = 0;
}).catch(()=>{
console.log(“TRACK SWITCH FAILED”);
});
This is not a mobile app by the way, it’s a website and loaded up in safari on iphone.