npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@clappr/stats-plugin

v0.3.0

Published

clappr playback stats report plugin

Downloads

37

Readme

npm version license

Usage

You can use it from JSDelivr https://cdn.jsdelivr.net/npm/@clappr/stats-plugin@latest/dist/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: {
        // optional: time in miliseconds for each report.
        // default: 5000
        runEach: 5000,
        // optional: callback function.
        // default: console.log
        onReport: (metrics) => {console.log(metrics)},
        // Fire PERCENTAGE_EVENT when video complete some percentage.
        // default: []
        onCompletion: [10, 20, 55, 100],
        // optional: provide an img uri hosted at the same place as your farm
        // or near of it prefferable 1x1px, without caching.
        // default: none
        uriToMeasureLatency: 'http://www.example.com/images/tv/pixel-1x1-red.gif',
        // optional: provide some assets uris hosted at the same place as your farm
        // or near of it prefferable in an uncompressible file format, without caching.
        // default: none
        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}
        ],
        // optional: number of reports between two consecutive bandwidth tests.
        // default: 10
        runBandwidthTestEvery: 10
      }
    })
</script>

Metrics

{
  counters: {
    play: 0, // number of plays
    pause: 0, // number of pauses
    error: 0, // number of errors
    buffering: 0, // number of bufferings
    decodedFrames: 0, // number of decoded frames (when available)
    droppedFrames: 0, // number of dropped frames (when available)
    fps: 0, // frames per second (when available)
    changeLevel: 0, // number of adaptative bitrate changes
    seek: 0, // number of seeks
    fullscreen: 0, // number of times that user went to fullscreen
    dvrUsage: 0 // number of time that user used dvr seek (at live stream)
  },
  timers: {
    startup: 0, // time (ms) since user click/touch play (intent to play) to the play
    watch: 0, // time (ms) of watched content (does not include pause and buffering)
    pause: 0, // time (ms) of paused content
    buffering: 0, // time (ms) of buffering
    session: 0, // time (ms) of session (sum of watch+pause+buffering)
    latency: 0, // time (ms) of latency between user and the provided uri
  },
  extra: {
    playbackName: '', // playback name (hls, html5_video, flashls)
    playbackType: '', // vod or live
    buffersize: 0, // buffersize in ms
    duration: 0, // duration time in ms
    currentTime: 0, // current time in ms
    bitratesHistory: [], // the bitrates changes history
    bitrateWeightedMean: 0, // bitrate weighted mean (bps)
    bitrateMostUsed: 0, // most used (based on time) bitrate (bps)
    watchHistory: [], // an array of an array of watched range time ex: [0, 2200]
    watchedPercentage: 0, // % of watched time
    bufferingPercentage: 0, // % of buffering time
    bandwidth: 0, // user bandwidth (bps)
  }
}