1.1.0 • Published 7 years ago

pure_player v1.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

PurePlayer

Build Status Version 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:

var myPlayer = document.getElementById('player').purePlayer({
    autoplay: false,
    format: 'video/mp4',
    video: {
        '720': {
            'src': '../example/video/720.mp4'
        },
        '480': {
            'src': '../example/video/480.mp4'
        },
        '360': {
            'src': '../example/video/360.mp4'
        }
    }
});

Available methods:

MethodDescription
.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
.onplayCall when video start playing. You can specify parameter to get position (in seconds) of current video.

Example:

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

Example:

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

Example:

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