LibJitisiMeet using ionic/cordova on android: changing camera facingMode

Hi all,

I’m struggling with the implementation of switching the camera from ‘user’ to ‘environment’ (Jitsi4 Angular, cordova deployment on android, Webview 74.x). I have the following constraints:

localTracksOptionsBackCamera = {
devices: [‘video’],
facingMode: ‘environment’,
constraints: {
video: {
aspectRatio: 4 / 3,
height: {
ideal: 720,
min: 240
}
}
}
};

localTracksOptionsFrontCamera = {
devices: [‘video’, ‘audio’],
facingMode: ‘user’,
constraints: {
video: {
aspectRatio: 4 / 3,
height: {
ideal: 720,
min: 240
}
}
}
};

When I call “createLocalTracks” with either the one or the other, I do get a suitable track as desired. But when I want to change to the back camera (the idea was to dispose the tracks and call createLocalTracks again with the other constraint), I get a warning:

lib-jitsi-meet.min.js:6 [modules/RTC/RTCUtils.js] <>: Failed to get access to local media. NotReadableError: Could not start video source [object Object]

and then an exception
polyfills.js:3027 Unhandled Promise rejection: Could not start video source ; Zone: ; Task: Promise.then ; Value: a {gum: {…}, name: “gum.general”, message: “Could not start video source”, stack: “Error↵ at new a (https://xx.xx.xx.xx/ass…(https://xx.xx.xx.xx/polyfills.js:2946:35)”} Error
at new a (https://xx.xx.xx.xx/assets/js/lib-jitsi-meet.min.js:6:118212)
at https://xx.xx.xx.xx/assets/js/lib-jitsi-meet.min.js:6:96086
at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (https://xx.xx.xx.xx/polyfills.js:2736:26)
at Zone.push…/node_modules/zone.js/dist/zone.js.Zone.run (https://xx.xx.xx.xx/polyfills.js:2495:43)
at https://xx.xx.xx.xx/polyfills.js:3234:34
at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (https://xx.xx.xx.xx/polyfills.js:2768:31)
at Zone.push…/node_modules/zone.js/dist/zone.js.Zone.runTask (https://xx.xx.xx.xx/polyfills.js:2540:47)
at drainMicroTaskQueue (https://xx.xx.xx.xx/polyfills.js:2946:35)

The cordova app already asks for camera permissions and these are granted. Any idea, what to do?

Okay, I found the problem. I still had an undisposed audio track when executing createLocalTrack with option to get as well video and audio. Chrome on desktop had no issue with this but webview on the Android tabled dropped this exception.