Usage
You can use it from JSDelivr https://cdn.jsdelivr.net/clappr.stats/latest/clappr-stats.min.js
or as a npm package.
<script>
var player = new Clappr.Player({
parentId: '#player',
plugins: [ClapprStats],
source: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
height: 360,
width: 640,
clapprStats: {
runEach: 5000,
onReport: (metrics) => {console.log(metrics)},
uriToMeasureLatency: 'http://www.example.com/images/tv/pixel-1x1-red.gif',
urisToMeasureBandwidth: [
{url: 'http://www.example.com/images/tv/500kb.jpg', timeout: 3000},
{url: 'http://www.example.com/images/tv/1mb.jpg', timeout: 6000},
{url: 'http://www.example.com/images/tv/5mb.jpg', timeout: 12000}
],
runBandwidthTestEvery: 10
}
})
</script>
Metrics
{
counters: {
play: 0,
pause: 0,
error: 0,
buffering: 0,
decodedFrames: 0,
droppedFrames: 0,
fps: 0,
changeLevel: 0,
seek: 0,
fullscreen: 0,
dvrUsage: 0
},
timers: {
startup: 0,
watch: 0,
pause: 0,
buffering: 0,
session: 0,
latency: 0,
},
extra: {
playbackName: '',
playbackType: '',
buffersize: 0,
duration: 0,
currentTime: 0,
bitratesHistory: [],
bitrateWeightedMean: 0,
bitrateMostUsed: 0,
watchHistory: [],
watchedPercentage: 0,
bufferingPercentage: 0,
bandwidth: 0,
}
}