Saturday, June 13, 2026
HomeiOS DevelopmentOpenVidu WebRTC replaceTrack for digital camera on ios safari loses audio enter

OpenVidu WebRTC replaceTrack for digital camera on ios safari loses audio enter

[ad_1]

I am not getting wherever on the openvidu discussion board with this challenge. I’ve an online app constructed utilizing openvidu for dwell streaming, every part works completely on all units besides ios

In safari on my iphone if i change the video observe to primarily change cameras to the again digital camera, the entire session loses audio enter. This does not occur on an android gadget or my net browsers, it is actually simply on the iphone.

Right here is how i am switching digital camera:

this.OV.getDevices().then((units)=> {

        let videoDevices = null;
        if(this.OVCurrentCamera === 'entrance'){
          videoDevices = units.filter(gadget => gadget.type === 'videoinput' && gadget.label !== 'Snap Digicam' && gadget.label.toLowerCase().indexOf('again') !== -1);
        }else{
          videoDevices = units.filter(gadget => gadget.type === 'videoinput' && gadget.label !== 'Snap Digicam' && gadget.label.toLowerCase().indexOf('entrance') !== -1);
        }

        if(videoDevices){

        
          // get new gadget id
          // if we already on entrance the again gadget is the final one within the checklist in any other case the primary
          let newDeviceId = this.OVCurrentCamera === 'entrance' ?  videoDevices[videoDevices.length - 1].deviceId : videoDevices[0].deviceId;


          this.OV.getUserMedia(<any>{
           
            videoSource: newDeviceId,
           
          }).then((mediaStream) =>  {

          
            let videoTrack = mediaStream.getVideoTracks()[0];
           
            this.OVPublisher.replaceTrack(videoTrack).then(() => {
              this.OVCurrentCamera = this.OVCurrentCamera === 'entrance' ? 'again' : 'entrance';
            }).catch(() => {
              this.toast.error('There was an issue switching cameras.');
            })

          }).catch((error) => {
            console.log("USER MEDIA ERROR",error)
          })


        }else{
          this.toast.error('May Not Load Your Cameras');
        }

      })

Even when the button is tapped once more to return to the entrance going through digital camera the audio enter would not come again.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments