Giter VIP home page Giter VIP logo

Comments (3)

InnovateAsterisk avatar InnovateAsterisk commented on June 15, 2024

This project is not optimised for mobile devices. It may work, and it may not work. In my testing, I have seen all sorts of issue with this.

On mobile this is referred to as facing mode:
https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode
but on Desktop, this hint is meaningless.

from browser-phone.

prathibhacdac avatar prathibhacdac commented on June 15, 2024

While changing the front camera to back camera, I get the following error:
Error on getUserMedia DOMException: Could not start video source

No one else is using the webcam.

In Windows, switching the camera works fine. Whereas the above error occurs on Android.

from browser-phone.

prathibhacdac avatar prathibhacdac commented on June 15, 2024

Switch camera is now working in android as well.

We need to stop the previous mediaStreamObj before calling getUserMedia again. In switchVideoSource function add

pc.getSenders().forEach(function (RTCRtpSender) {
            if(RTCRtpSender.track && RTCRtpSender.track.kind == "video") {
                RTCRtpSender.track.stop();
             }
    });

navigator.mediaDevices.getUserMedia(constraints).then(function(newStream){
    var newMediaTrack = newStream.getVideoTracks()[0];
     console.log("New Media Track",newMediaTrack);
    // var pc = session.sessionDescriptionHandler.peerConnection;
    pc.getSenders().forEach(function (RTCRtpSender) {
        if(RTCRtpSender.track && RTCRtpSender.track.kind == "video") {
            console.log("Switching Video Track : "+ RTCRtpSender.track.label + " to "+ newMediaTrack.label);
            //RTCRtpSender.track.stop();
            RTCRtpSender.replaceTrack(newMediaTrack);
            localStream.addTrack(newMediaTrack);
        }
    });
}).catch(function(e){
    console.error("Error on getUserMedia", e.name, e.message, constraints);
});

from browser-phone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.