我正在使用 Twilio 并twilio-video
v beta-2
依靠此repo
的主分支 https://github.com/twilio/video-quickstart-js
我必须显示选择的媒体并将设备推入其中,并且开关在 ios safari 浏览器上工作,但它不适用于 chrome 浏览器和 firefox 浏览器上的 android nasier
NotReadableError: could not start a video source
我的updateVideoDevice
功能如下
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)
});
}
}