Skip to content

Commit

Permalink
webrtc: prevent NotReadableError when publishing with Android (#2698) (
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Dec 26, 2023
1 parent e6fec31 commit 1feeba9
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions internal/servers/webrtc/publish_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,19 @@
}

navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(() => Promise.all([
populateDevices(),
populateCodecs(),
]))
.then(() => {
state = DEVICE;
render();
.then((stream) => {
return Promise.all([
populateDevices(),
populateCodecs(),
])
.then(() => {
// free the webcam to prevent 'NotReadableError' on Android
stream.getTracks()
.forEach(track => track.stop());

state = DEVICE;
render();
});
})
.catch((err) => {
state = ERROR;
Expand Down

0 comments on commit 1feeba9

Please sign in to comment.