1.0.5 • Published 9 years ago

video-prefetcher v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

video-prefetcher Build Status

HTML5 video prefetch library.

Installation

npm install video-prefetcher

Dependency

Usage

<video width="400" src="Google_Developer_Stories.webm" id="video">
</video>
var VideoPrefetcher = require("video-prefetcher");
// <video> has `src` attribute
var video = document.getElementById("video");
var prefetcher = new VideoPrefetcher(video);
prefetcher.onProgress(function (event) {
    var percentComplete = event.loaded / event.total;
    console.log((percentComplete * 100) + "%");
});
prefetcher.onLoad(function (event) {
    // automatically, replace <video> src to fetched blob url.
    console.log("loaded", event);
});
prefetcher.onError(function (error) {
    console.error(error, error.stack);
});
prefetcher.start();

Tests

npm test

Contributing

  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

License

MIT

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago