Skip to content

Commit

Permalink
track the initial play state
Browse files Browse the repository at this point in the history
  • Loading branch information
vpalmisano committed Dec 16, 2024
1 parent 5cc34b5 commit 50c36ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/video-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ webrtcperf.videoStats = {
const playingTimer = new webrtcperf.Timer()
const bufferingTimer = new webrtcperf.Timer()
this.collectedVideos.set(video, { playingTimer, bufferingTimer })
video.addEventListener(
'play',
() => {
playingTimer.start()
bufferingTimer.stop()
},
{ once: true },
)
video.addEventListener('playing', () => {
playingTimer.start()
bufferingTimer.stop()
Expand Down

0 comments on commit 50c36ce

Please sign in to comment.