项目作者: ollyxar

项目描述 :
HTML5 Javascript player
高级语言: JavaScript
项目地址: git://github.com/ollyxar/PurePlayer.git
创建时间: 2017-06-09T10:29:25Z
项目社区:https://github.com/ollyxar/PurePlayer

开源协议:MIT License

下载


PurePlayer

Build Status
Version
Downloads
License

HTML5 Javascript player

PurePlayer

With this player you can add video in different quality. You can see basic usage in the example folder.

Basic usage:

document.querySelector('video.my-player').purePlayer();

Advanced usage:

  1. var myPlayer = document.getElementById('player').purePlayer({
  2. autoplay: false,
  3. format: 'video/mp4',
  4. video: {
  5. '720': {
  6. 'src': '../example/video/720.mp4'
  7. },
  8. '480': {
  9. 'src': '../example/video/480.mp4'
  10. },
  11. '360': {
  12. 'src': '../example/video/360.mp4'
  13. }
  14. }
  15. });

Available methods:

Method Description
.play() Play the video
.pause() Pause the video
.stop() Stop playing and set position to start
.setPosition(5) Set current position (in seconds)
.destroy() Remove current player
.init() Initiate player after removing

Available events:

onplay
.onplay Call when video start playing. You can specify parameter to get position (in seconds) of current video.

Example:

  1. myPlayer.onplay = function (currentPosition) {
  2. console.log('Play video from ', currentPosition);
  3. }
onpause
.onpause Call when video pause playing. You can specify parameter to get position (in seconds) of current video.

Example:

  1. myPlayer.onpause = function (currentPosition) {
  2. console.log('Pause video from ', currentPosition);
  3. }
onend
.onend Call when video finished.

Example:

  1. myPlayer.onend = function () {
  2. console.log('The end!');
  3. }