mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
add autoPlayback
This commit is contained in:
1 parent
b46dacd353
commit
429753aa6e
57 files changed
+528
-454
No files matched your search
@@ -1056,3 +1056,20 @@ var art = new Artplayer({
|
||||
lock: true,
|
||||
});
|
||||
```
|
||||
|
||||
## autoPlayback
|
||||
|
||||
- Type: `Boolean`
|
||||
- Default: `false`
|
||||
|
||||
Whether to use auto playback
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
autoPlayback: true,
|
||||
});
|
||||
```
|
||||
@@ -1057,3 +1057,20 @@ var art = new Artplayer({
|
||||
lock: true,
|
||||
});
|
||||
```
|
||||
|
||||
## autoPlayback
|
||||
|
||||
- 类型: `Boolean`
|
||||
- 默认: `false`
|
||||
|
||||
是否使用自动回放功能
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
autoPlayback: true,
|
||||
});
|
||||
```
|
||||
@@ -147,6 +147,7 @@ export default class Artplayer extends Emitter {
|
||||
useSSR: false,
|
||||
playsInline: true,
|
||||
lock: true,
|
||||
autoPlayback: false,
|
||||
ads: [],
|
||||
layers: [],
|
||||
contextmenu: [],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { errorHandle, isMobile, has, def } from '../utils';
|
||||
import miniProgressBar from './miniProgressBar';
|
||||
import lock from './lock';
|
||||
import autoPlayback from './autoPlayback';
|
||||
import lock from './lock';
|
||||
|
||||
export default class Plugins {
|
||||
constructor(art) {
|
||||
@@ -18,7 +18,9 @@ export default class Plugins {
|
||||
this.add(lock);
|
||||
}
|
||||
|
||||
this.add(autoPlayback);
|
||||
if (option.autoPlayback) {
|
||||
this.add(autoPlayback);
|
||||
}
|
||||
|
||||
for (let index = 0; index < option.plugins.length; index++) {
|
||||
this.add(option.plugins[index]);
|
||||
|
||||
@@ -57,6 +57,7 @@ export default {
|
||||
useSSR: b,
|
||||
playsInline: b,
|
||||
lock: b,
|
||||
autoPlayback: b,
|
||||
ads: [
|
||||
{
|
||||
url: s,
|
||||
|
||||
+5
@@ -329,6 +329,11 @@ type Option = {
|
||||
*/
|
||||
lock?: boolean;
|
||||
|
||||
/**
|
||||
* Whether use auto playback
|
||||
*/
|
||||
autoPlayback?: boolean;
|
||||
|
||||
/**
|
||||
* Custom plugin list
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user