FLV format support
This commit is contained in:
@@ -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
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+6
File diff suppressed because one or more lines are too long
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user