Skip to content

Commit

Permalink
Allow to override getUserMedia stream
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano committed Aug 29, 2023
1 parent db912ae commit e609963
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/get-user-media.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,14 @@ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
if (window.PARAMS?.getUserMediaWaitTime > 0) {
await sleep(window.PARAMS?.getUserMediaWaitTime)
}
const mediaStream = await nativeGetUserMedia(constraints, ...args)
let mediaStream = await nativeGetUserMedia(constraints, ...args)
if (window.overrideGetUserMediaStream !== undefined) {
try {
mediaStream = window.overrideGetUserMediaStream(mediaStream)
} catch (err) {
log(`overrideGetUserMediaStream error:`, err)
}
}
try {
collectMediaTracks(mediaStream)
} catch (err) {
Expand Down

0 comments on commit e609963

Please sign in to comment.