|
@@ -91,7 +91,7 @@ video.defaultQuality | - | [see more details](http://dplayer.js.org/#/home?id=qu
|
|
|
video.url | - | video url
|
|
|
video.pic | - | video poster
|
|
|
video.thumbnails | - | video thumbnails, generated by [DPlayer-thumbnails](https://github.com/MoePlayer/DPlayer-thumbnails)
|
|
|
-video.type | 'auto' | values: 'auto', 'hls', 'flv', 'dash', 'webtorrent' or custom type, [see more details](http://dplayer.js.org/#/home?id=mse-support)
|
|
|
+video.type | 'auto' | values: 'auto', 'hls', 'flv', 'dash', 'webtorrent', 'normal' or other custom type, [see more details](http://dplayer.js.org/#/home?id=mse-support)
|
|
|
video.customType | - | custom video type, [see more details](http://dplayer.js.org/#/home?id=mse-support)
|
|
|
subtitle | - | external subtitle
|
|
|
subtitle.url | `required` | subtitle url
|
|
@@ -174,10 +174,10 @@ const dp = new DPlayer({
|
|
|
|
|
|
+ `dp.pause()`: pause video
|
|
|
|
|
|
-+ `dp.seek(time: number)`: seek to specified millisecond time
|
|
|
++ `dp.seek(time: number)`: seek to specified time
|
|
|
|
|
|
```js
|
|
|
- dp.seek(1000);
|
|
|
+ dp.seek(100);
|
|
|
```
|
|
|
|
|
|
+ `dp.toggle()`: toggle between play and pause
|
|
@@ -199,7 +199,11 @@ const dp = new DPlayer({
|
|
|
});
|
|
|
```
|
|
|
|
|
|
-+ `dp.notice(text: string, time: number)`: show message
|
|
|
++ `dp.notice(text: string, time: number, opacity: number)`: show message, the unit of time is millisecond, the default of time is 2000, the default of opacity is 0.8
|
|
|
+
|
|
|
+ ```js
|
|
|
+ dp.notice('Amazing player', 2000, 0.8);
|
|
|
+ ```
|
|
|
|
|
|
+ `dp.switchQuality(index: number)`: switch quality
|
|
|
|
|
@@ -207,11 +211,17 @@ const dp = new DPlayer({
|
|
|
|
|
|
+ `dp.speed(rate: number)`: set video speed
|
|
|
|
|
|
++ `dp.volume(percentage: number, nostorage: boolean, nonotice: boolean)`: set video volume
|
|
|
+
|
|
|
+ ```js
|
|
|
+ dp.volume(0.1, true, false);
|
|
|
+ ```
|
|
|
+
|
|
|
+ `dp.video`: native video
|
|
|
|
|
|
+ `dp.video.currentTime`: returns the current playback position
|
|
|
|
|
|
- + `dp.video.loop`: returns whether the video should start over again when finished
|
|
|
+ + `dp.video.duration`: returns video total time
|
|
|
|
|
|
+ `dp.video.paused`: returns whether the video paused
|
|
|
|
|
@@ -570,6 +580,39 @@ const dp = new DPlayer({
|
|
|
});
|
|
|
```
|
|
|
|
|
|
+### Work with other HLS library
|
|
|
+
|
|
|
+DPlayer can work with any HLS library via `customType` option.
|
|
|
+
|
|
|
+<div class="dplayer-wrap">
|
|
|
+ <div id="dplayer10"><button class="docute-button load">Click to load player</div>
|
|
|
+</div>
|
|
|
+
|
|
|
+```html
|
|
|
+<link rel="stylesheet" href="DPlayer.min.css">
|
|
|
+<div id="dplayer"></div>
|
|
|
+<script src="pearplayer.js"></script>
|
|
|
+<script src="DPlayer.min.js"></script>
|
|
|
+```
|
|
|
+
|
|
|
+```js
|
|
|
+const dp = new DPlayer({
|
|
|
+ container: document.getElementById('dplayer'),
|
|
|
+ video: {
|
|
|
+ url: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4',
|
|
|
+ type: 'pearplayer',
|
|
|
+ customType: {
|
|
|
+ 'pearplayer': function (video, player) {
|
|
|
+ new PearPlayer(video, {
|
|
|
+ src: video.src,
|
|
|
+ autoplay: player.options.autoplay
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+});
|
|
|
+```
|
|
|
+
|
|
|
## Live
|
|
|
|
|
|
<div class="dplayer-wrap">
|