Skip to content

Commit

Permalink
Optimize fake media stream track generation with improved event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano committed Feb 12, 2025
1 parent 158edf6 commit bcfb4a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/get-user-media.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ webrtcperf.getFakeTrack = async kind => {
video.loop = true
video.crossOrigin = 'anonymous'
video.autoplay = true
video.play()
video.addEventListener(
'canplay',
'canplaythrough',
() => {
webrtcperf.log(`[getFakeTrack] Creating fake media stream done`)
webrtcperf.fakeVideo._refcount = 0
resolve(video.captureStream())
},
Expand All @@ -140,6 +140,7 @@ webrtcperf.getFakeTrack = async kind => {
},
{ once: true },
)
video.play()
})
}
const stream = await webrtcperf.fakeStream
Expand Down

0 comments on commit bcfb4a1

Please sign in to comment.