Update build:docs and trans:docs scripts

This commit is contained in:
Harvey Zack committed 2023-11-26 13:23:21 +08:00
1 parent a2d3e20479
commit a2b57495a2
20 files changed
+749 -775

No files matched your search

@@ -1,8 +1,8 @@
# 实例事件
# Example Events
播放器的事件分为两种,一种视频的 `原生事件` (前缀 `video:`),另外一种是 `自定义事件`
Player events are divided into two types, one is the video's `native events` (prefix `video:`), the other is `custom events`
监听事件:
Listening to events:
<div className="run-code">▶ Run Code</div>
@@ -17,7 +17,7 @@ art.on('video:canplay', () => {
});
```
只监听一次事件:
Listen to an event only once:
<div className="run-code">▶ Run Code</div>
@@ -32,7 +32,7 @@ art.once('video:canplay', () => {
});
```
手动触发事件:
Manually trigger an event:
<div className="run-code">▶ Run Code</div>
@@ -45,7 +45,7 @@ var art = new Artplayer({
art.emit('focus');
```
移除事件:
Remove an event:
<div className="run-code">▶ Run Code</div>
@@ -63,15 +63,14 @@ const onReady = () => {
art.on('ready', onReady);
```
:::warning 全部事件请参考以下地址:
:::warning For a full list of events, please refer to the following address:
[artplayer/types/events.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/events.d.ts)
:::
## `ready`
当播放器首次可以播放器时触发
Triggered when the player is able to play for the first time
<div className="run-code">▶ Run Code</div>
@@ -88,7 +87,7 @@ art.on('ready', () => {
## `restart`
当播放器切换地址后并可以播放时触发
Triggered when the player switches the address and is able to play
<div className="run-code">▶ Run Code</div>
@@ -106,10 +105,9 @@ art.on('restart', (url) => {
console.info('restart', url);
});
```
## `pause`
当播放器暂停时触发
Triggered when the player is paused
<div className="run-code">▶ Run Code</div>
@@ -126,7 +124,7 @@ art.on('pause', () => {
## `play`
当播放器播放时触发
Triggered when the player starts playing
<div className="run-code">▶ Run Code</div>
@@ -143,7 +141,7 @@ art.on('play', () => {
## `hotkey`
当播放器热键被按下时触发
Triggered when a hotkey on the player is pressed
<div className="run-code">▶ Run Code</div>
@@ -160,7 +158,7 @@ art.on('hotkey', (event) => {
## `destroy`
当播放器销毁时触发
Triggered when the player is destroyed
<div className="run-code">▶ Run Code</div>
@@ -181,7 +179,7 @@ art.on('destroy', () => {
## `focus`
当播放器获得焦点时触发
Triggered when the player gains focus
<div className="run-code">▶ Run Code</div>
@@ -198,7 +196,7 @@ art.on('focus', (event) => {
## `blur`
当播放器失去焦点时触发
Triggered when the player loses focus
<div className="run-code">▶ Run Code</div>
@@ -215,7 +213,7 @@ art.on('blur', (event) => {
## `dblclick`
当播放器被双击时触发
Triggered when the player is double-clicked
<div className="run-code">▶ Run Code</div>
@@ -229,10 +227,9 @@ art.on('dblclick', (event) => {
console.info('dblclick', event);
});
```
## `click`
当播放器被单击时触发
Triggered when the player is clicked
<div className="run-code">▶ Run Code</div>
@@ -249,7 +246,7 @@ art.on('click', (event) => {
## `error`
当播放器加载视频发生错误时触发
Triggered when an error occurs while the player is loading the video
<div className="run-code">▶ Run Code</div>
@@ -263,10 +260,9 @@ art.on('error', (error, reconnectTime) => {
console.info(error, reconnectTime);
});
```
## `hover`
当播放器被鼠标移出或者移入时触发
Triggered when the player is hovered or unhovered by the mouse
<div className="run-code">▶ Run Code</div>
@@ -283,7 +279,7 @@ art.on('hover', (state, event) => {
## `mousemove`
当播放器被鼠标经过时触发
Triggered when the mouse moves over the player
<div className="run-code">▶ Run Code</div>
@@ -297,10 +293,9 @@ art.on('mousemove', (event) => {
console.info('mousemove', event);
});
```
## `resize`
当播放器尺寸变化时触发
Triggered when the player size changes
<div className="run-code">▶ Run Code</div>
@@ -317,7 +312,7 @@ art.on('resize', () => {
## `view`
当播放器出现在视口时触发
Triggered when the player appears in the viewport
<div className="run-code">▶ Run Code</div>
@@ -334,7 +329,7 @@ art.on('view', (state) => {
## `lock`
在移动端,当锁定的状态发生变化时触发
On mobile, triggered when the locked state changes
<div className="run-code">▶ Run Code</div>
@@ -352,7 +347,7 @@ art.on('lock', (state) => {
## `aspectRatio`
当播放器长宽比变化时触发
Triggered when the aspect ratio of the player changes
<div className="run-code">▶ Run Code</div>
@@ -371,7 +366,7 @@ art.on('aspectRatio', (aspectRatio) => {
## `autoHeight`
当播放器自动设置高度时触发
Triggered when the player automatically sets the height
<div className="run-code">▶ Run Code</div>
@@ -392,7 +387,7 @@ art.on('autoHeight', (height) => {
## `autoSize`
当播放器自动设置尺寸时触发
Triggered when the player automatically sets the size
<div className="run-code">▶ Run Code</div>
@@ -407,10 +402,9 @@ art.on('autoSize', () => {
console.info('autoSize');
});
```
## `flip`
当播放器发生翻转时触发
Triggered when the player flips
<div className="run-code">▶ Run Code</div>
@@ -429,7 +423,7 @@ art.on('flip', (flip) => {
## `fullscreen`
当播放器发生窗口全屏时触发
Triggered when the player goes into full screen
<div className="run-code">▶ Run Code</div>
@@ -444,10 +438,9 @@ art.on('fullscreen', (state) => {
console.info('fullscreen', state);
});
```
## `fullscreenWeb`
当播放器发生网页全屏时触发
Triggered when the player enters web fullscreen
<div className="run-code">▶ Run Code</div>
@@ -465,7 +458,7 @@ art.on('fullscreenWeb', (state) => {
## `mini`
当播放器进入迷你模式时触发
Triggered when the player enters mini mode
<div className="run-code">▶ Run Code</div>
@@ -483,10 +476,9 @@ art.on('mini', (state) => {
console.info('mini', state);
});
```
## `pip`
当播放器进入画中画时触发
Triggered when the player enters Picture-in-Picture mode
<div className="run-code">▶ Run Code</div>
@@ -504,7 +496,7 @@ art.on('pip', (state) => {
## `screenshot`
当播放器被截图时触发
Triggered when the player takes a screenshot
<div className="run-code">▶ Run Code</div>
@@ -519,10 +511,9 @@ art.on('screenshot', (dataUri) => {
console.info('screenshot', dataUri);
});
```
## `seek`
当播放器发生时间跳转时触发
Triggered when the player jumps in time
<div className="run-code">▶ Run Code</div>
@@ -539,7 +530,7 @@ art.on('seek', (currentTime) => {
## `subtitleOffset`
当播放器发生字幕偏移时触发
Triggered when the subtitle offset occurs in the player
<div className="run-code">▶ Run Code</div>
@@ -558,10 +549,9 @@ art.on('subtitleOffset', (offset) => {
console.info('subtitleOffset', offset);
});
```
## `subtitleUpdate`
当字幕更新时触发
Triggered when the subtitle updates
<div className="run-code">▶ Run Code</div>
@@ -581,7 +571,7 @@ art.on('subtitleUpdate', (text) => {
## `subtitleLoad`
当字幕加载时触发
Triggered when the subtitle loads
<div className="run-code">▶ Run Code</div>
@@ -598,10 +588,9 @@ art.on('subtitleLoad', (url) => {
console.info('subtitleLoad', url);
});
```
## `subtitleSwitch`
当字幕切换时触发
Triggered when subtitles switch
<div className="run-code">▶ Run Code</div>
@@ -625,7 +614,7 @@ art.on('subtitleSwitch', (url) => {
## `info`
当信息面板显示或隐藏时触发
Triggered when the information panel is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -639,10 +628,9 @@ art.on('info', (state) => {
console.log(state);
});
```
## `layer`
当自定义层显示或隐藏时触发
Triggered when a custom layer is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -659,7 +647,7 @@ art.on('layer', (state) => {
## `loading`
当加载器显示或隐藏时触发
Triggered when a loader is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -676,7 +664,7 @@ art.on('loading', (state) => {
## `mask`
当遮罩层显示或隐藏时触发
Triggered when a mask layer is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -693,7 +681,7 @@ art.on('mask', (state) => {
## `subtitle`
当字幕层显示或隐藏时触发
Triggered when the subtitle layer is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -710,7 +698,7 @@ art.on('subtitle', (state) => {
## `contextmenu`
当右键菜单显示或隐藏时触发
Triggered when the right-click menu is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -727,7 +715,7 @@ art.on('contextmenu', (state) => {
## `control`
当控制器显示或隐藏时触发
Triggered when the controller is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -744,7 +732,7 @@ art.on('control', (state) => {
## `setting`
当设置面板显示或隐藏时触发
Triggered when the settings panel is shown or hidden
<div className="run-code">▶ Run Code</div>
@@ -762,7 +750,7 @@ art.on('setting', (state) => {
## `muted`
当静音的状态变化时触发
Triggered when the muted state changes
<div className="run-code">▶ Run Code</div>
@@ -779,85 +767,83 @@ art.on('muted', (state) => {
## `video:canplay`
浏览器可以播放媒体文件了,但估计没有足够的数据来支撑播放到结束,不必停下来进一步缓冲内容
The browser can play the media file, but estimates there is not enough data to play through to the end without having to stop for further buffering
## `video:canplaythrough`
浏览器估计它可以在不停止内容缓冲的情况下播放媒体直到结束
The browser estimates it can play the media through to the end without stopping for content buffering
## `video:complete`
OfflineAudioContext 渲染完成
OfflineAudioContext rendering is complete
## `video:durationchange`
duration 属性的值改变时触发
Triggered when the value of the duration property changes
## `video:emptied`
媒体内容变为空;例如,当这个 media 已经加载完成(或者部分加载完成),则发送此事件,并调用 load() 方法重新加载它
The media content becomes empty; for example, when this media has been completely loaded (or partially loaded), this event is sent and the load() method is called to reload it
```
## `video:ended`
视频停止播放,因为 media 已经到达结束点
The video has stopped because the media reached the end point
## `video:error`
获取媒体数据时出错,或者资源类型不是受支持的媒体格式
An error occurred while fetching media data, or the resource type is not a supported media format
## `video:loadeddata`
media 中的首帧已经完成加载
The first frame of the media has finished loading
## `video:loadedmetadata`
已加载元数据
Metadata has been loaded
## `video:pause`
播放已暂停
Playback has been paused
## `video:play`
播放已开始
Playback has started
## `video:playing`
由于缺乏数据而暂停或延迟后,播放准备开始
Playback is ready to start following a pause or delay due to lack of data
## `video:progress`
在浏览器加载资源时周期性触发
Periodically triggered while the browser is loading resources
## `video:ratechange`
播放速率发生变化
The playback rate has changed
## `video:seeked`
跳帧(seek)操作完成
A seek (frame skipping) operation has completed
## `video:seeking`
跳帧(seek)操作开始
A seek (frame skipping) operation has started
## `video:stalled`
用户代理(user agent)正在尝试获取媒体数据,但数据意外未出现
The user agent is trying to fetch media data, but the data unexpectedly has not appeared
## `video:suspend`
媒体数据加载已暂停
Media data loading has been suspended
## `video:timeupdate`
currentTime 属性指定的时间发生变化
The time specified by the currentTime attribute has changed
## `video:volumechange`
音量发生变化
Volume changed
## `video:waiting`
由于暂时缺少数据,播放已停止
Playback has stopped due to temporarily missing data