FLV format support

This commit is contained in:
DIYgod
2016-10-26 17:13:54 +08:00
parent 78bd6a0e6c
commit d0442e4891
5 changed files with 41 additions and 4 deletions
+22 -1
View File
@@ -141,7 +141,7 @@ xhr.open('get', 'https://dplayer.daoapp.io/video/bilibili?aid=【bilibili视频A
xhr.send(null);
```
**Live Video (HTTP Live Streaming, M3U8 format)**
**Live Video (HTTP Live Streaming, M3U8 format) support**
It requires the library [hls.js](https://github.com/dailymotion/hls.js) and it should be loaded before DPlayer.min.js.
@@ -164,6 +164,27 @@ var dp = new DPlayer({
</script>
```
**FLV format support**
It requires the library [flv.js](https://github.com/Bilibili/flv.js) and it should be loaded before DPlayer.min.js.
```HTML
<div id="player1" class="dplayer"></div>
<!-- ... -->
<script src="plugin/flv.min.js"></script>
<script src="dist/DPlayer.min.js"></script>
<script>
var dp = new DPlayer({
// ...
video: {
url: 'xxx.flv'
// ...
}
});
</script>
```
**Work with module bundler**
```js
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+6
View File
File diff suppressed because one or more lines are too long
+10
View File
@@ -293,6 +293,16 @@ class DPlayer {
});
}
// Support FLV
if (this.option.video.url.match(/(flv)$/i) && flvjs.isSupported()) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: this.option.video.url
});
flvPlayer.attachMediaElement(this.video);
flvPlayer.load();
}
this.bezel = this.element.getElementsByClassName('dplayer-bezel-icon')[0];
this.bezel.addEventListener('animationend', () => {
this.bezel.classList.remove('dplayer-bezel-transition');