A ponyfill/polyfill for VideoPlaybackQuality.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
example
src
test
.gitignore
.travis.yml
LICENSE
README.md
package.json
polyfill.js
tsconfig.json

README.md

VideoPlaybackQuality-polyfill

A polyfill/ponyfill for HTMLVideoElement.prototype.getVideoPlaybackQuality().

HTMLVideoElement.prototype.getVideoPlaybackQuality() return a VideoPlaybackQuality object.

For more details, see Media Playback Quality

example

Install

Install with npm:

npm install videoplaybackquality

Usage

Polyfill

require("videoplaybackquality/polyfill");
// usage
var video = document.getElementById("js-video");
console.log(video.getVideoPlaybackQuality());

Use as a module(Ponyfill)

const getVideoPlaybackQuality = require("videoplaybackquality").getVideoPlaybackQuality;
// usage
var video = document.getElementById("js-video");
getVideoPlaybackQuality(video);
/*
{
        'droppedVideoFrames': 0,
        'totalVideoFrames': 0,
        'corruptedVideoFrames': 0,
        'creationTime': 0,
        'totalFrameDelay': 0
}
*

Example

See example/

Notes 📝

VideoPlaybackQuality is connected each Video source. In other words, It will be reset when replace exist video source with new source.

Limitation

WebKit can not get complete VideoPlaybackQuality.

This polyfill return following data:

{
        'droppedVideoFrames': webKitVideo.webkitDroppedFrameCount,
        'totalVideoFrames': webKitVideo.webkitDecodedFrameCount,
        // Not provided by this polyfill:
        'corruptedVideoFrames': 0,
        'creationTime': NaN,
        'totalFrameDelay': 0
}

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu