I am using Twilio with twilio-video
v beta-2
counting on the master branch of this repohttps://github.com/twilio/video-quickstart-js
I got to display the select media and push the devices into it and the switch is working on ios safari browser, but it's not working on android nasier on chrome browser and firefox browser
NotReadableError: could not start a video source
my updateVideoDevice
function is as the following
function updateVideoDevice(event) {
const select = event.target
const localParticipant = room.localParticipant
log('change fired ' + select.value);
if (select.value !== '') {
Video.createLocalVideoTrack({
audio: true,
video: {width: 640},
deviceId: {exact: select.value}
}).then((localVideoTrack) => {
const tracks = Array.from(localParticipant.videoTracks.values())
.map(publication => publication.track);
localParticipant.unpublishTracks(tracks)
console.log(localParticipant.identity + " removed track: " + tracks[0].kind)
tracks.forEach(track => {
track.detach().forEach(detachedElement => {
detachedElement.remove()
})
})
localParticipant.publishTrack(localVideoTrack)
console.log(localParticipant.identity + " added track: " + localVideoTrack.kind)
const previewContainer = document.getElementById('local-media');
if (!previewContainer.querySelector('video')) {
attachParticipantTracks(room.localParticipant, previewContainer)
}
// attachTracks([localVideoTrack], previewContainer)
}).catch((error) => {
log(error)
});
}
}