An approach to get QoS-related metrics from mpegts.js/flv.js player.
Compatible with both mpegts.js/flv.js libraries.
Only applicable to MSEPlayer
Install And Usage
npm i mpegtsjs-metric
importEnableQoSfrom'mpegtsjs-metric'// enable mpegts.js/flv.js with qos-related metricsEnableQoS()// get metric from the MSE playerplayer.getMetric.then(metric=>{// do something}).catch(err=>{// fail to get metric})
Metrics
The resolved object metric includes the following properties:
property
explanation
buffered
An array that containes multiple objects, each of them has start and end property, representing the startTime and endTime of the current video buffer
duration
The duration of the video source. Infinity when the source is live.
currentTime
The current playback time of the video
mimeTypes
Audio/Video type and Codec. Undetected when there is no video/audio