mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
update docs
This commit is contained in:
1 parent
03fcc89abf
commit
9e90028be6
46 files changed
+186
-135
No files matched your search
@@ -48,6 +48,31 @@ var art = new Artplayer({
|
||||
});
|
||||
```
|
||||
|
||||
## Ready Callback
|
||||
|
||||
- Type: `Function`
|
||||
- Default: `undefined`
|
||||
|
||||
The constructor accepts a function as the second parameter, fired when the player is initialized and the video can be play, just like `ready` event
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
muted: true,
|
||||
}, function() {
|
||||
this.play();
|
||||
});
|
||||
```
|
||||
|
||||
:::tip 提示
|
||||
|
||||
The `this` in the callback function is the player instance, but the callback function is used to use the arrow function, `this` is not to point to the player instance
|
||||
|
||||
:::
|
||||
|
||||
## poster
|
||||
|
||||
- Type: `String`
|
||||
|
||||
@@ -48,6 +48,32 @@ var art = new Artplayer({
|
||||
});
|
||||
```
|
||||
|
||||
## Ready Callback
|
||||
|
||||
- 类型: `Function`
|
||||
- 默认: `undefined`
|
||||
|
||||
构造函数接受一个函数作为第二个参数,播放器初始化成功且视频可以播放时触发,和`ready`事件一样
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
muted: true,
|
||||
}, function() {
|
||||
this.play();
|
||||
});
|
||||
```
|
||||
|
||||
:::tip 提示
|
||||
|
||||
回调函数里的`this`就是播放器实例,但回调函数假如使用了箭头函数,`this`则不会指向播放器实例
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## poster
|
||||
|
||||
- 类型: `String`
|
||||
|
||||
Reference in new issue
Block a user