2013-02-09 01:20:59 +03:00
|
|
|
<!DOCTYPE html>
|
2016-04-29 00:29:40 +02:00
|
|
|
<html lang="en">
|
2013-02-09 01:20:59 +03:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2013-02-11 17:49:30 +03:00
|
|
|
<title>Video.js Plugin Example</title>
|
2013-02-09 01:20:59 +03:00
|
|
|
|
2015-06-06 03:10:39 +02:00
|
|
|
<!-- Load the source files -->
|
2018-01-30 18:17:41 +02:00
|
|
|
<link href="../dist/video-js.css" rel="stylesheet" type="text/css">
|
2017-06-27 01:51:05 +02:00
|
|
|
<script src="../dist/video.js"></script>
|
2013-02-09 01:20:59 +03:00
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p style="background-color:#eee; border: 1px solid #777; padding: 10px; font-size: .8em; line-height: 1.5em; font-family: Verdana, sans-serif;">This page shows you how to create, register and initialize a Video.js plugin.</p>
|
|
|
|
|
2020-11-16 22:13:27 +02:00
|
|
|
<video id="vid1" class="video-js" controls preload="auto" width="640" height="264" poster="https://vjs.zencdn.net/v/oceans.png">
|
|
|
|
<source src="https://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
|
|
|
|
<source src="https://vjs.zencdn.net/v/oceans.webm" type="video/webm">
|
|
|
|
<source src="https://vjs.zencdn.net/v/oceans.ogv" type="video/ogg">
|
2013-02-09 01:20:59 +03:00
|
|
|
<p>Video Playback Not Supported</p>
|
|
|
|
</video>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
(function() {
|
2013-02-11 21:05:39 +03:00
|
|
|
var vid1, progressed;
|
2013-02-09 01:20:59 +03:00
|
|
|
|
|
|
|
// create a really simple plugin
|
|
|
|
// this one just logs the buffered percentage to the console whenever
|
|
|
|
// more data is downloaded
|
|
|
|
progressed = function(options) {
|
|
|
|
this.on('progress', function(e) {
|
|
|
|
console.log(this.bufferedPercent());
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
// register the plugin
|
2015-10-28 22:06:33 +02:00
|
|
|
videojs.plugin('progressed', progressed);
|
2013-02-09 01:20:59 +03:00
|
|
|
|
|
|
|
// initialize it
|
2015-10-28 22:06:33 +02:00
|
|
|
vid1 = videojs('vid1');
|
2013-02-11 18:16:08 +03:00
|
|
|
vid1.progressed();
|
2013-02-09 01:20:59 +03:00
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|