media-stream-player-js icon indicating copy to clipboard operation
media-stream-player-js copied to clipboard

MSP debugging events

Open sourZi opened this issue 4 years ago • 3 comments

Hi,

I'm wondering if it would be possible to include more debugging events?

Also, would it be possible to add the following kind of information to the client stream data overlay:

  • Stream uptime
  • Buffer delay
  • Dropped frames

image

sourZi avatar Jan 21 '21 10:01 sourZi

Not sure about displaying it in the stats box, but adding debug logging for MSP shouldn't too much of a problem.

What kind of information are you interested in?

lekoaf avatar Jan 21 '21 10:01 lekoaf

The following would be of interest to log on certain events on a video element

  • on playing and timeupdate events, log:
    • currentTime: the videoElement.currentTime
    • delay: time (in seconds) between current playTime and what is already buffered in the player (videoElement.buffered.end(videoElement.buffered.length - 1) - videoElement.currentTime)
  • on progress event, log:
    • bufferedEnd: videoElement.buffered.end(videoElement.buffered.length - 1)
  • on play event:
    • some data about the video like e.g. resolution

Check HTMLMediaElement for docs on the different events.

sourZi avatar Jan 29 '21 16:01 sourZi

For the stats, we can add the uptime as the pipeline's currentTime (which is exposed by both H.264 and MJPEG pipelines), and the delay as videoElement.buffered.end(videoElement.buffered.length - 1) - videoElement.currentTime. For the dropped frames, we can use:

if (videoElement.getVideoPlaybackQuality !== undefined) {
  const { droppedVideoFrames, totalVideoFrames } = videoElement.getVideoPlaybackQuality()
  droppedFramesText = `${droppedVideoFrames} of ${totalVideoFrames}`
} else if (videoElement.webkitDecodedFrameCount !== undefined) {
  droppedFramesText = `${videoElement.webkitDroppedFrameCount} of ${videoElement.webkitDecodedFrameCount}`
}

steabert avatar Feb 02 '21 13:02 steabert