Switch between the Cameras

Hi, I am developing an video conferencing application for a social cause, using the Jitsi Meet API library. I need the ways to switch between the Cameras. Can anyone please provide me a snippet for that.

var switchCamera = (facingMode) => {
    var aLocalTrackOptions = {
        devices: ["video"]
    };

    if (facingMode === "environment") {
        aLocalTrackOptions.facingMode = "environment";
    }  else {
        aLocalTrackOptions.facingMode = "user";
    }

    JitsiMeetJS.createLocalTracks(aLocalTrackOptions)
        .then(this.onLocalTracksCreated.bind(this))
        .catch(this.onLocalTracksFailure.bind(this));
};
1 Like

in onLocalTracksCreated you still have to removeTrack(oldCamera) and addTrack(newCamera) - at least this is how it works in my code - or is there an more easy way?

Hi, @ShahidNaumanTEO, did you get any solution for a simple camera switch? Thank you.

Hi @der_christoph, nice! Could you share any example of how you are working with switch cam, please? Thanks!