mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:41:20 -08:00
Update build:docs and trans:docs scripts
This commit is contained in:
1 parent
a2d3e20479
commit
a2b57495a2
20 files changed
+749
-775
No files matched your search
@@ -1,10 +1,10 @@
|
||||
# 视频广告
|
||||
# Video Ads
|
||||
|
||||
## 演示
|
||||
## Demo
|
||||
|
||||
👉 [查看完整演示](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-ads/index.js&example=ads)
|
||||
👉 [View Full Demo](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-ads/index.js&example=ads)
|
||||
|
||||
## 安装
|
||||
## Installation
|
||||
|
||||
::: code-group
|
||||
|
||||
@@ -39,8 +39,7 @@ https://unpkg.com/artplayer-plugin-ads/dist/artplayer-plugin-ads.js
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## 使用
|
||||
## Usage
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-ads/index.js">
|
||||
▶ Run Code
|
||||
@@ -55,32 +54,32 @@ var art = new Artplayer({
|
||||
fullscreenWeb: true,
|
||||
plugins: [
|
||||
artplayerPluginAds({
|
||||
// html广告,假如是视频广告则忽略该值
|
||||
// HTML ad, ignored if it's a video ad
|
||||
html: '<img src="/assets/sample/poster.jpg">',
|
||||
|
||||
// 视频广告的地址
|
||||
// URL of the video ad
|
||||
video: '/assets/sample/test1.mp4',
|
||||
|
||||
// 广告跳转网址,为空则不跳转
|
||||
// Ad redirect URL, no redirection if empty
|
||||
url: 'http://artplayer.org',
|
||||
|
||||
// 必须观看的时长,期间不能被跳过,单位为秒
|
||||
// 当该值大于或等于totalDuration时,不能提前关闭广告
|
||||
// 当该值等于或小于0时,则随时都可以关闭广告
|
||||
// The duration that must be watched, which can't be skipped, in seconds
|
||||
// If this value is greater than or equal to totalDuration, the ad can't be closed early
|
||||
// If this value is less than or equal to 0, then the ad can be closed at any time
|
||||
playDuration: 5,
|
||||
|
||||
// 广告总时长,单位为秒
|
||||
// Total duration of the ad, in seconds
|
||||
totalDuration: 10,
|
||||
|
||||
// 视频广告是否默认静音
|
||||
// Whether the video ad is muted by default
|
||||
muted: false,
|
||||
|
||||
// 多语言支持
|
||||
// Multilingual support
|
||||
i18n: {
|
||||
close: '关闭广告',
|
||||
countdown: '%s秒',
|
||||
detail: '查看详情',
|
||||
canBeClosed: '%s秒后可关闭广告',
|
||||
close: 'Close ad',
|
||||
countdown: '%s seconds',
|
||||
detail: 'See details',
|
||||
canBeClosed: '%s seconds until the ad can be closed',
|
||||
},
|
||||
}),
|
||||
],
|
||||
@@ -95,4 +94,4 @@ art.on('artplayerPluginAds:click', (ads) => {
|
||||
art.on('artplayerPluginAds:skip', (ads) => {
|
||||
console.info(ads);
|
||||
});
|
||||
```
|
||||
```
|
||||
@@ -1,10 +1,10 @@
|
||||
# 弹幕库
|
||||
# Danmuku Library
|
||||
|
||||
## 演示
|
||||
## Demo
|
||||
|
||||
👉 [查看完整演示](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-danmuku/index.js&example=danmuku)
|
||||
👉 [View Full Demo](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-danmuku/index.js&example=danmuku)
|
||||
|
||||
## 安装
|
||||
## Installation
|
||||
|
||||
::: code-group
|
||||
|
||||
@@ -67,7 +67,7 @@ https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
|
||||
}
|
||||
```
|
||||
|
||||
## 使用弹幕数组
|
||||
## Using Danmuku Array
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
@@ -80,14 +80,14 @@ var art = new Artplayer({
|
||||
setting: true,
|
||||
plugins: [
|
||||
artplayerPluginDanmuku({
|
||||
// 弹幕数组
|
||||
// Danmuku array
|
||||
danmuku: [
|
||||
{
|
||||
text: '111', // 弹幕文本
|
||||
time: 1, // 发送时间,单位秒
|
||||
color: '#fff', // 弹幕局部颜色
|
||||
border: false, // 是否显示描边
|
||||
mode: 0, // 弹幕模式: 0表示滚动, 1静止
|
||||
text: '111', // Danmuku text
|
||||
time: 1, // Send time, in seconds
|
||||
color: '#fff', // Danmuku local color
|
||||
border: false, // Whether to display outline
|
||||
mode: 0, // Danmuku mode: 0 for scrolling, 1 for stationary
|
||||
},
|
||||
{
|
||||
text: '222',
|
||||
@@ -108,8 +108,9 @@ var art = new Artplayer({
|
||||
],
|
||||
});
|
||||
```
|
||||
Sure, below is the translation of the provided Markdown content into English, maintaining the original Markdown formatting:
|
||||
|
||||
## 使用弹幕 XML
|
||||
## Using Danmuku XML
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
@@ -121,29 +122,28 @@ var art = new Artplayer({
|
||||
url: '/assets/sample/video.mp4',
|
||||
plugins: [
|
||||
artplayerPluginDanmuku({
|
||||
// 弹幕 XML 文件,和 Bilibili 网站的弹幕格式一致
|
||||
// Danmuku XML file, consistent with the danmuku format of the Bilibili website
|
||||
danmuku: '/assets/sample/danmuku.xml',
|
||||
}),
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## 使用异步调用
|
||||
## Using Asynchronous Call
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
</div>
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
plugins: [
|
||||
artplayerPluginDanmuku({
|
||||
// 使用 Promise 异步返回
|
||||
// Use Promise to return asynchronously
|
||||
danmuku: function () {
|
||||
return new Promise((resovle) => {
|
||||
return resovle([
|
||||
return new Promise((resolve) => {
|
||||
return resolve([
|
||||
{
|
||||
text: '111',
|
||||
time: 1,
|
||||
@@ -163,10 +163,9 @@ var art = new Artplayer({
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## `hide/show`
|
||||
|
||||
通过方法 `hide` 和 `show` 进行隐藏或者显示弹幕
|
||||
Hide or show the bullet comments with the methods `hide` and `show`.
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
@@ -184,14 +183,14 @@ var art = new Artplayer({
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: '隐藏弹幕',
|
||||
html: 'Hide Danmuku',
|
||||
click: function () {
|
||||
art.plugins.artplayerPluginDanmuku.hide();
|
||||
},
|
||||
},
|
||||
{
|
||||
position: 'right',
|
||||
html: '显示弹幕',
|
||||
html: 'Show Danmuku',
|
||||
click: function () {
|
||||
art.plugins.artplayerPluginDanmuku.show();
|
||||
},
|
||||
@@ -199,10 +198,9 @@ var art = new Artplayer({
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## `isHide`
|
||||
|
||||
通过属性 `isHide` 判断当前弹幕是隐藏或者显示
|
||||
Judge whether the current barrage is hidden or displayed with the `isHide` property.
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
@@ -220,24 +218,23 @@ var art = new Artplayer({
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: '隐藏弹幕',
|
||||
html: 'Hide Barrage',
|
||||
click: function (_, event) {
|
||||
if (art.plugins.artplayerPluginDanmuku.isHide) {
|
||||
art.plugins.artplayerPluginDanmuku.show();
|
||||
event.target.innerText = '隐藏弹幕';
|
||||
event.target.innerText = 'Hide Barrage';
|
||||
} else {
|
||||
art.plugins.artplayerPluginDanmuku.hide();
|
||||
event.target.innerText = '显示弹幕';
|
||||
event.target.innerText = 'Show Barrage';
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## `emit`
|
||||
|
||||
通过方法 `emit` 发送一条实时弹幕
|
||||
Send a real-time danmaku message through the `emit` method
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
@@ -255,9 +252,9 @@ var art = new Artplayer({
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: '发送弹幕',
|
||||
html: 'Send Danmaku',
|
||||
click: function () {
|
||||
var text = prompt('请输入弹幕文本', '弹幕测试文本');
|
||||
var text = prompt('Please enter the danmaku text', 'Danmaku test text');
|
||||
if (!text || !text.trim()) return;
|
||||
var color = '#' + Math.floor(Math.random() * 0xffffff).toString(16);
|
||||
art.plugins.artplayerPluginDanmuku.emit({
|
||||
@@ -270,10 +267,9 @@ var art = new Artplayer({
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## `config`
|
||||
|
||||
通过方法 `config` 实时改变弹幕配置,支持属性有:
|
||||
Change the barrage configuration in real-time with the `config` method, supported attributes include:
|
||||
|
||||
- `danmuku`
|
||||
- `speed`
|
||||
@@ -304,7 +300,7 @@ var art = new Artplayer({
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: '弹幕大小:<input type="range" min="12" max="50" step="1" value="25">',
|
||||
html: 'Danmaku size:<input type="range" min="12" max="50" step="1" value="25">',
|
||||
style: {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
@@ -321,10 +317,9 @@ var art = new Artplayer({
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## `load`
|
||||
|
||||
通过 load 方法可以重载弹幕源,或者切换新弹幕
|
||||
The load method can be used to reload the danmu data source or switch to new danmu.
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
@@ -342,14 +337,14 @@ var art = new Artplayer({
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: '重载弹幕',
|
||||
html: 'Reload Danmu',
|
||||
click: function () {
|
||||
art.plugins.artplayerPluginDanmuku.load();
|
||||
},
|
||||
},
|
||||
{
|
||||
position: 'right',
|
||||
html: '切换弹幕',
|
||||
html: 'Switch Danmu',
|
||||
click: function () {
|
||||
art.plugins.artplayerPluginDanmuku.config({
|
||||
danmuku: '/assets/sample/danmuku-v2.xml',
|
||||
@@ -360,10 +355,9 @@ var art = new Artplayer({
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## `reset`
|
||||
|
||||
用于清空当前显示的弹幕
|
||||
Used to clear the current displayed barrages
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
@@ -388,11 +382,13 @@ art.on('resize', () => {
|
||||
|
||||
## `option`
|
||||
|
||||
用于获取当前弹幕配置
|
||||
Used to get the current barrage configuration
|
||||
|
||||
<div className="run-code" data-libs="./uncompiled/artplayer-plugin-danmuku/index.js">
|
||||
▶ Run Code
|
||||
</div>
|
||||
▶ Run Code
|
||||
</div>
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
@@ -461,3 +457,28 @@ art.on('artplayerPluginDanmuku:destroy', () => {
|
||||
console.info('弹幕销毁');
|
||||
});
|
||||
```
|
||||
|
||||
Here is the translation of the VitePress extended Markdown syntax into English:
|
||||
|
||||
```markdown
|
||||
# Welcome to VitePress
|
||||
|
||||
## Project setup
|
||||
|
||||
```bash
|
||||
yarn
|
||||
yarn docs:dev
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
To build the documentation site, run the following command:
|
||||
|
||||
```bash
|
||||
yarn docs:build
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
To deploy the documentation site, you can use any static site hosting services.
|
||||
```
|
||||
@@ -1,10 +1,10 @@
|
||||
# Dash 画质
|
||||
# Dash Video Quality
|
||||
|
||||
## 演示
|
||||
## Demo
|
||||
|
||||
👉 [查看完整演示](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-quality/index.js&example=dash.quality)
|
||||
👉 [View the full demo](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-quality/index.js&example=dash.quality)
|
||||
|
||||
## 安装
|
||||
## Installation
|
||||
|
||||
::: code-group
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# HLS 画质
|
||||
# HLS Quality
|
||||
|
||||
## 演示
|
||||
## Demonstration
|
||||
|
||||
👉 [查看完整演示](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/8.0.0-beta.3/hls.min.js%0A./uncompiled/artplayer-plugin-hls-quality/index.js&example=hls.quality)
|
||||
👉 [View the full demo](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/8.0.0-beta.3/hls.min.js%0A./uncompiled/artplayer-plugin-hls-quality/index.js&example=hls.quality)
|
||||
|
||||
## 安装
|
||||
## Installation
|
||||
|
||||
::: code-group
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# Iframe 控制
|
||||
# Iframe Control
|
||||
|
||||
## 说明
|
||||
## Description
|
||||
|
||||
通过该插件,你可以轻松在 `index.html` 里控制跨域 `iframe.html` 页面里的播放器,如在 `index.html` 里通过代码控制 `iframe.html` 播放器的功能,或者获取 `iframe.html` 播放器的值
|
||||
With this plugin, you can easily control the player inside the cross-domain `iframe.html` page from within `index.html`. For example, you can control the functionalities of the `iframe.html` player from `index.html` or retrieve the values of the `iframe.html` player.
|
||||
|
||||
## 演示
|
||||
## Demonstration
|
||||
|
||||
👉 [查看完整演示](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-iframe/index.js&example=iframe)
|
||||
👉 [View full demonstration](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-iframe/index.js&example=iframe)
|
||||
|
||||
## 安装
|
||||
## Installation
|
||||
|
||||
::: code-group
|
||||
|
||||
@@ -29,7 +29,6 @@ pnpm add artplayer-plugin-iframe
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `CDN`
|
||||
|
||||
::: code-group
|
||||
@@ -44,7 +43,7 @@ https://unpkg.com/artplayer-plugin-iframe/dist/artplayer-plugin-iframe.js
|
||||
|
||||
:::
|
||||
|
||||
## 使用
|
||||
## Usage
|
||||
|
||||
::: code-group
|
||||
|
||||
@@ -107,12 +106,11 @@ https://unpkg.com/artplayer-plugin-iframe/dist/artplayer-plugin-iframe.js
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `index.html` 接口
|
||||
## `index.html` Interface
|
||||
|
||||
### `commit`
|
||||
|
||||
从 `index.html` 将消息推送到 `iframe.html`,该函数将在 `iframe.html` 内部运行,同时它也能用于异步获取 `iframe.html` 里的值
|
||||
Push messages from `index.html` to `iframe.html`. This function will run inside `iframe.html` and can also be used to asynchronously retrieve values from within `iframe.html`.
|
||||
|
||||
```js
|
||||
iframe.commit(() => {
|
||||
@@ -141,10 +139,9 @@ iframe.commit(() => {
|
||||
});
|
||||
})();
|
||||
```
|
||||
|
||||
### `message`
|
||||
|
||||
在 `index.html` 接收来自 `iframe.html` 的消息
|
||||
Receive messages from `iframe.html` in `index.html`
|
||||
|
||||
```js
|
||||
iframe.message((event) => {
|
||||
@@ -154,23 +151,23 @@ iframe.message((event) => {
|
||||
|
||||
### `destroy`
|
||||
|
||||
销毁后 `index.html` 无法与 `iframe.html` 通信
|
||||
After destruction, `index.html` can no longer communicate with `iframe.html`
|
||||
|
||||
```js
|
||||
iframe.destroy();
|
||||
```
|
||||
|
||||
## `iframe.html` 接口
|
||||
## `iframe.html` Interface
|
||||
|
||||
:::warning 提示
|
||||
:::warning Warning
|
||||
|
||||
`iframe.html` 接口 只能运行在 `iframe.html` 里
|
||||
The `iframe.html` interface can only run inside `iframe.html`
|
||||
|
||||
:::
|
||||
|
||||
### `inject`
|
||||
|
||||
注入脚本,接收来自 `index.html` 的消息
|
||||
Inject a script, receive messages from `index.html`
|
||||
|
||||
```js
|
||||
ArtplayerPluginIframe.inject();
|
||||
@@ -178,7 +175,7 @@ ArtplayerPluginIframe.inject();
|
||||
|
||||
### `postMessage`
|
||||
|
||||
将消息推送到 `index.html`
|
||||
Push messages to `index.html`
|
||||
|
||||
```js
|
||||
iframe.message((event) => {
|
||||
@@ -291,4 +288,4 @@ iframe.commit(() => {
|
||||
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
Reference in new issue
Block a user