From 8b32f050a023ab9a4d7e24be16d08c6063bfd8fe Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Sun, 17 Aug 2025 10:46:04 +0800 Subject: [PATCH] feat: add danmuku plugin documentation and i18n setup guide - Created a new documentation file for the danmuku plugin with code examples. - Added comprehensive language settings documentation, including default languages, importing languages, adding new languages, and modifying existing languages. - Updated the i18n setup guide to reflect changes in language handling and provide code snippets for implementation. --- docs/assets/ts/artplayer.d.ts | 29 +++++++++---------- docs/document/404.html | 2 +- docs/document/advanced/built-in.html | 2 +- docs/document/advanced/class.html | 2 +- docs/document/advanced/event.html | 2 +- docs/document/advanced/global.html | 2 +- docs/document/advanced/plugin.html | 2 +- docs/document/advanced/property.html | 2 +- ...md.C-lmXk5u.js => en_index.md.CVTkjvLi.js} | 8 ++--- ...u.lean.js => en_index.md.CVTkjvLi.lean.js} | 0 ...-iw6Bo.js => en_start_i18n.md.BsPhEMUT.js} | 2 +- ...n.js => en_start_i18n.md.BsPhEMUT.lean.js} | 0 ...ex.md.xi7dw2mq.js => index.md.B7z5s1WD.js} | 8 ++--- ...w2mq.lean.js => index.md.B7z5s1WD.lean.js} | 0 ...Vi5ow.js => plugin_danmuku.md.DGwdwoB_.js} | 2 +- ....js => plugin_danmuku.md.DGwdwoB_.lean.js} | 0 ....SWgTwNO6.js => start_i18n.md.DkqeV9gh.js} | 2 +- ...lean.js => start_i18n.md.DkqeV9gh.lean.js} | 0 docs/document/component/contextmenu.html | 2 +- docs/document/component/controls.html | 2 +- docs/document/component/layers.html | 2 +- docs/document/component/setting.html | 2 +- docs/document/en/advanced/built-in.html | 2 +- docs/document/en/advanced/class.html | 2 +- docs/document/en/advanced/event.html | 2 +- docs/document/en/advanced/global.html | 2 +- docs/document/en/advanced/plugin.html | 2 +- docs/document/en/advanced/property.html | 2 +- docs/document/en/component/contextmenu.html | 2 +- docs/document/en/component/controls.html | 2 +- docs/document/en/component/layers.html | 2 +- docs/document/en/component/setting.html | 2 +- docs/document/en/index.html | 12 ++++---- docs/document/en/start/i18n.html | 6 ++-- docs/document/en/start/option.html | 2 +- docs/document/hashmap.json | 2 +- docs/document/index.html | 12 ++++---- docs/document/plugin/danmuku.html | 6 ++-- docs/document/start/i18n.html | 6 ++-- docs/document/start/option.html | 2 +- packages/artplayer/types/artplayer.d.ts | 21 ++++++-------- packages/artplayer/types/option.d.ts | 8 ++--- 42 files changed, 82 insertions(+), 88 deletions(-) rename docs/document/assets/{en_index.md.C-lmXk5u.js => en_index.md.CVTkjvLi.js} (98%) rename docs/document/assets/{en_index.md.C-lmXk5u.lean.js => en_index.md.CVTkjvLi.lean.js} (100%) rename docs/document/assets/{en_start_i18n.md.Bj-iw6Bo.js => en_start_i18n.md.BsPhEMUT.js} (98%) rename docs/document/assets/{en_start_i18n.md.Bj-iw6Bo.lean.js => en_start_i18n.md.BsPhEMUT.lean.js} (100%) rename docs/document/assets/{index.md.xi7dw2mq.js => index.md.B7z5s1WD.js} (98%) rename docs/document/assets/{index.md.xi7dw2mq.lean.js => index.md.B7z5s1WD.lean.js} (100%) rename docs/document/assets/{plugin_danmuku.md.BYfVi5ow.js => plugin_danmuku.md.DGwdwoB_.js} (99%) rename docs/document/assets/{plugin_danmuku.md.BYfVi5ow.lean.js => plugin_danmuku.md.DGwdwoB_.lean.js} (100%) rename docs/document/assets/{start_i18n.md.SWgTwNO6.js => start_i18n.md.DkqeV9gh.js} (98%) rename docs/document/assets/{start_i18n.md.SWgTwNO6.lean.js => start_i18n.md.DkqeV9gh.lean.js} (100%) diff --git a/docs/assets/ts/artplayer.d.ts b/docs/assets/ts/artplayer.d.ts index 4a5f83ab7..8894db103 100644 --- a/docs/assets/ts/artplayer.d.ts +++ b/docs/assets/ts/artplayer.d.ts @@ -640,11 +640,11 @@ export interface Option { /** * Other video attribute */ - moreVideoAttr?: Partial<{ - [key in keyof HTMLVideoElement as HTMLVideoElement[key] extends (...args: unknown[]) => unknown + moreVideoAttr?: Partial unknown ? never - : key]: HTMLVideoElement[key] - }> + : K]: HTMLVideoElement[K] + }>> /** * Custom i18n @@ -1153,8 +1153,8 @@ export default class Artplayer extends Player { static readonly build: string static readonly config: Config static readonly utils: Utils - static readonly scheme: Record - static readonly Emitter: new (...args: any[]) => any + static readonly scheme: Record + static readonly Emitter: new (...args: unknown[]) => unknown static readonly validator: (option: T, scheme: object) => T static readonly kindOf: (item: unknown) => string static readonly html: Artplayer['template']['html'] @@ -1211,24 +1211,22 @@ export default class Artplayer extends Player { torrent?: unknown on(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): this - on(name: string, fn: (...args: any[]) => unknown, ctx?: object): this + on(name: string, fn: (...args: unknown[]) => unknown, ctx?: object): this once(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): this - once(name: string, fn: (...args: any[]) => unknown, ctx?: object): this + once(name: string, fn: (...args: unknown[]) => unknown, ctx?: object): this emit(name: T, ...args: Events[T]): this - emit(name: string, ...args: any[]): this + emit(name: string, ...args: unknown[]): this off(name: T, callback?: (...args: Events[T]) => unknown): this - off(name: string, callback?: (...args: any[]) => unknown): this + off(name: string, callback?: (...args: unknown[]) => unknown): this query: Artplayer['template']['query'] proxy: Artplayer['events']['proxy'] video: Artplayer['template']['$video'] - e: { - [K in keyof Events]?: { fn: (...args: Events[K]) => any, ctx: unknown }[] - } + e: { [K in keyof Events]?: { fn: (...args: Events[K]) => unknown, ctx: unknown }[] } destroy(removeHtml?: boolean): void @@ -1307,10 +1305,9 @@ export default class Artplayer extends Player { readonly plugins: { add: ( - plugin: (this: Artplayer, art: Artplayer) => any | Promise, + plugin: (this: Artplayer, art: Artplayer) => unknown | Promise, ) => Promise | Artplayer['plugins'] - [pluginName: string]: any - } + } & Record } export = Artplayer; diff --git a/docs/document/404.html b/docs/document/404.html index 07246c3ae..01342431c 100644 --- a/docs/document/404.html +++ b/docs/document/404.html @@ -21,7 +21,7 @@
- + \ No newline at end of file diff --git a/docs/document/advanced/built-in.html b/docs/document/advanced/built-in.html index 4096e387b..01cf3ed88 100644 --- a/docs/document/advanced/built-in.html +++ b/docs/document/advanced/built-in.html @@ -206,7 +206,7 @@ art.on('ready', () => { art.plugins.add(myPlugin); }); - + \ No newline at end of file diff --git a/docs/document/advanced/class.html b/docs/document/advanced/class.html index 00bb4da69..06ce8bba9 100644 --- a/docs/document/advanced/class.html +++ b/docs/document/advanced/class.html @@ -31,7 +31,7 @@ }); console.info([...Artplayer.instances]);

version ​

返回播放器的版本信息

▶ Run Code
js
console.info(Artplayer.version);

env ​

返回播放器的环境变量

▶ Run Code
js
console.info(Artplayer.env);

build ​

返回播放器的打包时间

▶ Run Code
js
console.info(Artplayer.build);

config ​

返回视频的默认配置

▶ Run Code
js
console.info(Artplayer.config);

utils ​

返回播放器的工具函数集合

▶ Run Code
js
console.info(Artplayer.utils);

全部工具函数请参考以下地址:

artplayer/types/utils.d.ts

scheme ​

返回播放器选项的校验方案

▶ Run Code
js
console.info(Artplayer.scheme);

Emitter ​

返回事件分发器的构造函数

▶ Run Code
js
console.info(Artplayer.Emitter);

validator ​

返回选项的校验函数

▶ Run Code
js
console.info(Artplayer.validator);

kindOf ​

返回类型检测的函数工具

▶ Run Code
js
console.info(Artplayer.kindOf);

html ​

返回播放器所需的 html 字符串

▶ Run Code
js
console.info(Artplayer.html);

option ​

返回播放器的默认选项

▶ Run Code
js
console.info(Artplayer.option);
- + \ No newline at end of file diff --git a/docs/document/advanced/event.html b/docs/document/advanced/event.html index 08463587b..f5295a178 100644 --- a/docs/document/advanced/event.html +++ b/docs/document/advanced/event.html @@ -385,7 +385,7 @@ art.on('keydown', (event) => { console.log(event.code); });

video:canplay ​

浏览器可以播放媒体文件了,但估计没有足够的数据来支撑播放到结束,不必停下来进一步缓冲内容

video:canplaythrough ​

浏览器估计它可以在不停止内容缓冲的情况下播放媒体直到结束

video:complete ​

OfflineAudioContext 渲染完成

video:durationchange ​

duration 属性的值改变时触发

video:emptied ​

媒体内容变为空;例如,当这个 media 已经加载完成(或者部分加载完成),则发送此事件,并调用 load() 方法重新加载它

video:ended ​

视频停止播放,因为 media 已经到达结束点

video:error ​

获取媒体数据时出错,或者资源类型不是受支持的媒体格式

video:loadeddata ​

media 中的首帧已经完成加载

video:loadedmetadata ​

已加载元数据

video:pause ​

播放已暂停

video:play ​

播放已开始

video:playing ​

由于缺乏数据而暂停或延迟后,播放准备开始

video:progress ​

在浏览器加载资源时周期性触发

video:ratechange ​

播放速率发生变化

video:seeked ​

跳帧(seek)操作完成

video:seeking ​

跳帧(seek)操作开始

video:stalled ​

用户代理(user agent)正在尝试获取媒体数据,但数据意外未出现

video:suspend ​

媒体数据加载已暂停

video:timeupdate ​

currentTime 属性指定的时间发生变化

video:volumechange ​

音量发生变化

video:waiting ​

由于暂时缺少数据,播放已停止

- + \ No newline at end of file diff --git a/docs/document/advanced/global.html b/docs/document/advanced/global.html index 38d037200..6d49fd063 100644 --- a/docs/document/advanced/global.html +++ b/docs/document/advanced/global.html @@ -240,7 +240,7 @@ url: '/assets/sample/video.mp4', miniProgressBar: true, }); - + \ No newline at end of file diff --git a/docs/document/advanced/plugin.html b/docs/document/advanced/plugin.html index c827bbed2..c73b282e2 100644 --- a/docs/document/advanced/plugin.html +++ b/docs/document/advanced/plugin.html @@ -122,7 +122,7 @@ }) ], }); - + \ No newline at end of file diff --git a/docs/document/advanced/property.html b/docs/document/advanced/property.html index 3f614b70a..23984244f 100644 --- a/docs/document/advanced/property.html +++ b/docs/document/advanced/property.html @@ -427,7 +427,7 @@ art.on('ready', () => { art.subtitleOffset = 1; }); - + \ No newline at end of file diff --git a/docs/document/assets/en_index.md.C-lmXk5u.js b/docs/document/assets/en_index.md.CVTkjvLi.js similarity index 98% rename from docs/document/assets/en_index.md.C-lmXk5u.js rename to docs/document/assets/en_index.md.CVTkjvLi.js index e9191dfbc..6311495f0 100644 --- a/docs/document/assets/en_index.md.C-lmXk5u.js +++ b/docs/document/assets/en_index.md.CVTkjvLi.js @@ -1,4 +1,4 @@ -import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"Installation and Usage","description":"","frontmatter":{},"headers":[],"relativePath":"en/index.md","filePath":"en/index.md","lastUpdated":1754013470000}'),p={name:"en/index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

Installation and Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
+import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"Installation and Usage","description":"","frontmatter":{},"headers":[],"relativePath":"en/index.md","filePath":"en/index.md","lastUpdated":1754013470000}'),p={name:"en/index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

Installation and Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
           });
         </script>
     </body>
-</html>

Warning

The player's size depends on the size of the container container, so your container container must have a size.

You can find more usage examples at the link below

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

Warning

The player's size depends on the size of the container container, so your container container must have a size.

You can find more usage examples at the link below

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="artRef"></div>
 </template>
 
@@ -83,7 +83,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
     },
   },
 };
-</script>

Artplayer Not Responsive:

Modifying option directly in Vue.js will not change the player

React.js ​

jsx
import { useEffect, useRef } from 'react';
+</script>

Artplayer Not Responsive:

Modifying option directly in Vue.js will not change the player

React.js ​

jsx
import { useEffect, useRef } from 'react';
 import Artplayer from 'artplayer';
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -171,7 +171,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

Ancient Browsers ​

The production build of artplayer.js is only compatible with the latest major version of Chrome: last 1 Chrome version

For ancient browsers, you can use the artplayer.legacy.js file, which is compatible up to: IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, please modify the following configuration and then build it yourself:

Build configuration: scripts/build.js

Refer to documentation: browserslist

ECMAScript Module ​

Starting from 5.2.4, artplayer and all plugins will also provide an ESM version of js, such as:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

Ancient Browsers ​

The production build of artplayer.js is only compatible with the latest major version of Chrome: last 1 Chrome version

For ancient browsers, you can use the artplayer.legacy.js file, which is compatible up to: IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, please modify the following configuration and then build it yourself:

Build configuration: scripts/build.js

Refer to documentation: browserslist

ECMAScript Module ​

Starting from 5.2.4, artplayer and all plugins will also provide an ESM version of js, such as:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
diff --git a/docs/document/assets/en_index.md.C-lmXk5u.lean.js b/docs/document/assets/en_index.md.CVTkjvLi.lean.js
similarity index 100%
rename from docs/document/assets/en_index.md.C-lmXk5u.lean.js
rename to docs/document/assets/en_index.md.CVTkjvLi.lean.js
diff --git a/docs/document/assets/en_start_i18n.md.Bj-iw6Bo.js b/docs/document/assets/en_start_i18n.md.BsPhEMUT.js
similarity index 98%
rename from docs/document/assets/en_start_i18n.md.Bj-iw6Bo.js
rename to docs/document/assets/en_start_i18n.md.BsPhEMUT.js
index 42882246d..4d9d7c77b 100644
--- a/docs/document/assets/en_start_i18n.md.Bj-iw6Bo.js
+++ b/docs/document/assets/en_start_i18n.md.BsPhEMUT.js
@@ -2,7 +2,7 @@ import{_ as a,c as i,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

Importing Languages ​

Language files before packaging are located in: artplayer/src/i18n/*.js. You are welcome to add your language. Packaged language files are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
+});

Importing Languages ​

Language files before packaging are located in: artplayer/src/i18n/*.js. You are welcome to add your language. Packaged language files are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
 import zhTw from 'artplayer/dist/i18n/zh-tw.js';
 
 var art = new Artplayer({
diff --git a/docs/document/assets/en_start_i18n.md.Bj-iw6Bo.lean.js b/docs/document/assets/en_start_i18n.md.BsPhEMUT.lean.js
similarity index 100%
rename from docs/document/assets/en_start_i18n.md.Bj-iw6Bo.lean.js
rename to docs/document/assets/en_start_i18n.md.BsPhEMUT.lean.js
diff --git a/docs/document/assets/index.md.xi7dw2mq.js b/docs/document/assets/index.md.B7z5s1WD.js
similarity index 98%
rename from docs/document/assets/index.md.xi7dw2mq.js
rename to docs/document/assets/index.md.B7z5s1WD.js
index e142eaff3..a11d68249 100644
--- a/docs/document/assets/index.md.xi7dw2mq.js
+++ b/docs/document/assets/index.md.B7z5s1WD.js
@@ -1,4 +1,4 @@
-import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"安装使用","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1754013470000}'),p={name:"index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
+import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"安装使用","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1754013470000}'),p={name:"index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
           });
         </script>
     </body>
-</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="artRef"></div>
 </template>
 
@@ -83,7 +83,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
     },
   },
 };
-</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import { useEffect, useRef } from 'react';
+</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import { useEffect, useRef } from 'react';
 import Artplayer from 'artplayer';
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -171,7 +171,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.4 开始,artplayer和所有插件还会提供一个ESM版本的js,如:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.4 开始,artplayer和所有插件还会提供一个ESM版本的js,如:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
diff --git a/docs/document/assets/index.md.xi7dw2mq.lean.js b/docs/document/assets/index.md.B7z5s1WD.lean.js
similarity index 100%
rename from docs/document/assets/index.md.xi7dw2mq.lean.js
rename to docs/document/assets/index.md.B7z5s1WD.lean.js
diff --git a/docs/document/assets/plugin_danmuku.md.BYfVi5ow.js b/docs/document/assets/plugin_danmuku.md.DGwdwoB_.js
similarity index 99%
rename from docs/document/assets/plugin_danmuku.md.BYfVi5ow.js
rename to docs/document/assets/plugin_danmuku.md.DGwdwoB_.js
index 4ae04f163..ff1bfb813 100644
--- a/docs/document/assets/plugin_danmuku.md.BYfVi5ow.js
+++ b/docs/document/assets/plugin_danmuku.md.DGwdwoB_.js
@@ -1,4 +1,4 @@
-import{_ as n,c as l,o as p,ak as s,j as i}from"./chunks/framework.xxfEszSJ.js";const y=JSON.parse('{"title":"弹幕库","description":"","frontmatter":{},"headers":[],"relativePath":"plugin/danmuku.md","filePath":"plugin/danmuku.md","lastUpdated":1734270991000}'),h={name:"plugin/danmuku.md"};function e(k,a,t,r,E,d){return p(),l("div",null,a[0]||(a[0]=[s(`

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
+import{_ as n,c as l,o as p,ak as s,j as i}from"./chunks/framework.xxfEszSJ.js";const y=JSON.parse('{"title":"弹幕库","description":"","frontmatter":{},"headers":[],"relativePath":"plugin/danmuku.md","filePath":"plugin/danmuku.md","lastUpdated":1734270991000}'),h={name:"plugin/danmuku.md"};function e(k,a,t,r,E,d){return p(),l("div",null,a[0]||(a[0]=[s(`

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
     text: '', // 弹幕文本
     time: 10, // 弹幕时间, 默认为当前播放器时间
     mode: 0, // 弹幕模式: 0: 滚动(默认),1: 顶部,2: 底部
diff --git a/docs/document/assets/plugin_danmuku.md.BYfVi5ow.lean.js b/docs/document/assets/plugin_danmuku.md.DGwdwoB_.lean.js
similarity index 100%
rename from docs/document/assets/plugin_danmuku.md.BYfVi5ow.lean.js
rename to docs/document/assets/plugin_danmuku.md.DGwdwoB_.lean.js
diff --git a/docs/document/assets/start_i18n.md.SWgTwNO6.js b/docs/document/assets/start_i18n.md.DkqeV9gh.js
similarity index 98%
rename from docs/document/assets/start_i18n.md.SWgTwNO6.js
rename to docs/document/assets/start_i18n.md.DkqeV9gh.js
index 41e38076b..da1b36093 100644
--- a/docs/document/assets/start_i18n.md.SWgTwNO6.js
+++ b/docs/document/assets/start_i18n.md.DkqeV9gh.js
@@ -2,7 +2,7 @@ import{_ as a,c as i,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const c
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
+});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
 import zhTw from 'artplayer/dist/i18n/zh-tw.js';
 
 var art = new Artplayer({
diff --git a/docs/document/assets/start_i18n.md.SWgTwNO6.lean.js b/docs/document/assets/start_i18n.md.DkqeV9gh.lean.js
similarity index 100%
rename from docs/document/assets/start_i18n.md.SWgTwNO6.lean.js
rename to docs/document/assets/start_i18n.md.DkqeV9gh.lean.js
diff --git a/docs/document/component/contextmenu.html b/docs/document/component/contextmenu.html
index 9ea4dac85..52be15dc5 100644
--- a/docs/document/component/contextmenu.html
+++ b/docs/document/component/contextmenu.html
@@ -106,7 +106,7 @@
         })
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/component/controls.html b/docs/document/component/controls.html index 27be4ecec..34c48b5ec 100644 --- a/docs/document/component/controls.html +++ b/docs/document/component/controls.html @@ -153,7 +153,7 @@ }); }, 3000); });
- + \ No newline at end of file diff --git a/docs/document/component/layers.html b/docs/document/component/layers.html index 9c0cda2d2..29ca7eb9d 100644 --- a/docs/document/component/layers.html +++ b/docs/document/component/layers.html @@ -125,7 +125,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/component/setting.html b/docs/document/component/setting.html index a4c08b39e..eb7e0fe35 100644 --- a/docs/document/component/setting.html +++ b/docs/document/component/setting.html @@ -245,7 +245,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/advanced/built-in.html b/docs/document/en/advanced/built-in.html index 2afc924c0..b7bf8176d 100644 --- a/docs/document/en/advanced/built-in.html +++ b/docs/document/en/advanced/built-in.html @@ -206,7 +206,7 @@ art.on('ready', () => { art.plugins.add(myPlugin); }); - + \ No newline at end of file diff --git a/docs/document/en/advanced/class.html b/docs/document/en/advanced/class.html index 1d50fccba..cc6f7cc02 100644 --- a/docs/document/en/advanced/class.html +++ b/docs/document/en/advanced/class.html @@ -31,7 +31,7 @@ }); console.info([...Artplayer.instances]);

version ​

Returns the version information of the player.

▶ Run Code
js
console.info(Artplayer.version);

env ​

Returns the environment variables of the player.

▶ Run Code
js
console.info(Artplayer.env);

build ​

Returns the build time of the player

▶ Run Code
js
console.info(Artplayer.build);

config ​

Returns the default configuration of the video

▶ Run Code
js
console.info(Artplayer.config);

utils ​

Returns a collection of utility functions for the player

▶ Run Code
js
console.info(Artplayer.utils);

For the full list of utility functions, please refer to the following address:

artplayer/types/utils.d.ts

scheme ​

Returns the validation scheme for the player options

▶ Run Code
js
console.info(Artplayer.scheme);

Emitter ​

Returns the constructor for the event dispatcher

▶ Run Code
js
console.info(Artplayer.Emitter);

validator ​

Returns the validation function for options

▶ Run Code
js
console.info(Artplayer.validator);

kindOf ​

Returns the function tool for type checking

▶ Run Code
js
console.info(Artplayer.kindOf);

html ​

Returns the html string required for the player

▶ Run Code
js
console.info(Artplayer.html);

option ​

Returns the player's default options

▶ Run Code
js
console.info(Artplayer.option);
- + \ No newline at end of file diff --git a/docs/document/en/advanced/event.html b/docs/document/en/advanced/event.html index 46b040da4..7f0ca1834 100644 --- a/docs/document/en/advanced/event.html +++ b/docs/document/en/advanced/event.html @@ -385,7 +385,7 @@ art.on('keydown', (event) => { console.log(event.code); });

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 rendering is complete

video:durationchange ​

Triggered when the value of the duration property changes

video:emptied ​

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 ​

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 ​

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 ​

A seek (frame skipping) operation has completed

video:seeking ​

A seek (frame skipping) operation has started

video:stalled ​

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 ​

The time specified by the currentTime attribute has changed

video:volumechange ​

Volume changed

video:waiting ​

Playback has stopped due to temporarily missing data

- + \ No newline at end of file diff --git a/docs/document/en/advanced/global.html b/docs/document/en/advanced/global.html index 53f529098..15be384b7 100644 --- a/docs/document/en/advanced/global.html +++ b/docs/document/en/advanced/global.html @@ -245,7 +245,7 @@ url: '/assets/sample/video.mp4', miniProgressBar: true, }); - + \ No newline at end of file diff --git a/docs/document/en/advanced/plugin.html b/docs/document/en/advanced/plugin.html index 6207b15f8..b52407ef4 100644 --- a/docs/document/en/advanced/plugin.html +++ b/docs/document/en/advanced/plugin.html @@ -122,7 +122,7 @@ }) ], }); - + \ No newline at end of file diff --git a/docs/document/en/advanced/property.html b/docs/document/en/advanced/property.html index a7927f302..48f41be30 100644 --- a/docs/document/en/advanced/property.html +++ b/docs/document/en/advanced/property.html @@ -428,7 +428,7 @@ art.on('ready', () => { art.subtitleOffset = 1; }); - + \ No newline at end of file diff --git a/docs/document/en/component/contextmenu.html b/docs/document/en/component/contextmenu.html index c416c8cfe..4ae5117aa 100644 --- a/docs/document/en/component/contextmenu.html +++ b/docs/document/en/component/contextmenu.html @@ -106,7 +106,7 @@ }) }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/component/controls.html b/docs/document/en/component/controls.html index 9a883e56a..ed053d3d1 100644 --- a/docs/document/en/component/controls.html +++ b/docs/document/en/component/controls.html @@ -153,7 +153,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/component/layers.html b/docs/document/en/component/layers.html index b0f108018..943851e8b 100644 --- a/docs/document/en/component/layers.html +++ b/docs/document/en/component/layers.html @@ -125,7 +125,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/component/setting.html b/docs/document/en/component/setting.html index 3a524a446..73c4e7855 100644 --- a/docs/document/en/component/setting.html +++ b/docs/document/en/component/setting.html @@ -245,7 +245,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/index.html b/docs/document/en/index.html index c96168550..1c1b9fef0 100644 --- a/docs/document/en/index.html +++ b/docs/document/en/index.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

Installation and Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
+    
Skip to content

Installation and Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -44,7 +44,7 @@
           });
         </script>
     </body>
-</html>

Warning

The player's size depends on the size of the container container, so your container container must have a size.

You can find more usage examples at the link below

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

Warning

The player's size depends on the size of the container container, so your container container must have a size.

You can find more usage examples at the link below

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="artRef"></div>
 </template>
 
@@ -108,7 +108,7 @@
     },
   },
 };
-</script>

Artplayer Not Responsive:

Modifying option directly in Vue.js will not change the player

React.js ​

jsx
import { useEffect, useRef } from 'react';
+</script>

Artplayer Not Responsive:

Modifying option directly in Vue.js will not change the player

React.js ​

jsx
import { useEffect, useRef } from 'react';
 import Artplayer from 'artplayer';
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -196,7 +196,7 @@
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

Ancient Browsers ​

The production build of artplayer.js is only compatible with the latest major version of Chrome: last 1 Chrome version

For ancient browsers, you can use the artplayer.legacy.js file, which is compatible up to: IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, please modify the following configuration and then build it yourself:

Build configuration: scripts/build.js

Refer to documentation: browserslist

ECMAScript Module ​

Starting from 5.2.4, artplayer and all plugins will also provide an ESM version of js, such as:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

Ancient Browsers ​

The production build of artplayer.js is only compatible with the latest major version of Chrome: last 1 Chrome version

For ancient browsers, you can use the artplayer.legacy.js file, which is compatible up to: IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, please modify the following configuration and then build it yourself:

Build configuration: scripts/build.js

Refer to documentation: browserslist

ECMAScript Module ​

Starting from 5.2.4, artplayer and all plugins will also provide an ESM version of js, such as:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
@@ -254,7 +254,7 @@
         </script>
     </body>
 </html>

Warning

You need to modify it before import the Artplayer for it to take effect

- + \ No newline at end of file diff --git a/docs/document/en/start/i18n.html b/docs/document/en/start/i18n.html index 6a27f0566..5228c334d 100644 --- a/docs/document/en/start/i18n.html +++ b/docs/document/en/start/i18n.html @@ -13,7 +13,7 @@ - + @@ -27,7 +27,7 @@ container: '.artplayer-app', url: '/assets/sample/video.mp4', lang: 'zh-cn', // or 'en' -});

Importing Languages ​

Language files before packaging are located in: artplayer/src/i18n/*.js. You are welcome to add your language. Packaged language files are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
+});

Importing Languages ​

Language files before packaging are located in: artplayer/src/i18n/*.js. You are welcome to add your language. Packaged language files are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
 import zhTw from 'artplayer/dist/i18n/zh-tw.js';
 
 var art = new Artplayer({
@@ -75,7 +75,7 @@
         },
     },
 });
- + \ No newline at end of file diff --git a/docs/document/en/start/option.html b/docs/document/en/start/option.html index 9525825de..d1775b414 100644 --- a/docs/document/en/start/option.html +++ b/docs/document/en/start/option.html @@ -411,7 +411,7 @@ url: '/assets/sample/video.mp4', proxy: () => document.createElement('video') }); - + \ No newline at end of file diff --git a/docs/document/hashmap.json b/docs/document/hashmap.json index 238757671..d46c21d90 100644 --- a/docs/document/hashmap.json +++ b/docs/document/hashmap.json @@ -1 +1 @@ -{"advanced_built-in.md":"B5ccy6gK","advanced_class.md":"Da3aE0pP","advanced_event.md":"mrsB0MsK","advanced_global.md":"C-56tmUD","advanced_plugin.md":"B3Pobmcq","advanced_property.md":"D59FnDH1","component_contextmenu.md":"ClKmcIKr","component_controls.md":"Cl62yW1F","component_layers.md":"Cys52VMi","component_setting.md":"BP5674ir","en_advanced_built-in.md":"CY71IZlq","en_advanced_class.md":"C3V-LDO3","en_advanced_event.md":"D5Yv5LYW","en_advanced_global.md":"BbhNIAMt","en_advanced_plugin.md":"hspsx5uD","en_advanced_property.md":"COS94_z7","en_component_contextmenu.md":"DgD64wIy","en_component_controls.md":"Bj2oItzY","en_component_layers.md":"BNGRBNoB","en_component_setting.md":"Dqvlpr4j","en_index.md":"C-lmXk5u","en_start_i18n.md":"Bj-iw6Bo","en_start_option.md":"6JX4hU8Q","index.md":"xi7dw2mq","plugin_danmuku.md":"BYfVi5ow","start_i18n.md":"SWgTwNO6","start_option.md":"B5CHO-We"} +{"advanced_built-in.md":"B5ccy6gK","advanced_class.md":"Da3aE0pP","advanced_event.md":"mrsB0MsK","advanced_global.md":"C-56tmUD","advanced_plugin.md":"B3Pobmcq","advanced_property.md":"D59FnDH1","component_contextmenu.md":"ClKmcIKr","component_controls.md":"Cl62yW1F","component_layers.md":"Cys52VMi","component_setting.md":"BP5674ir","en_advanced_built-in.md":"CY71IZlq","en_advanced_class.md":"C3V-LDO3","en_advanced_event.md":"D5Yv5LYW","en_advanced_global.md":"BbhNIAMt","en_advanced_plugin.md":"hspsx5uD","en_advanced_property.md":"COS94_z7","en_component_contextmenu.md":"DgD64wIy","en_component_controls.md":"Bj2oItzY","en_component_layers.md":"BNGRBNoB","en_component_setting.md":"Dqvlpr4j","en_index.md":"CVTkjvLi","en_start_i18n.md":"BsPhEMUT","en_start_option.md":"6JX4hU8Q","index.md":"B7z5s1WD","plugin_danmuku.md":"DGwdwoB_","start_i18n.md":"DkqeV9gh","start_option.md":"B5CHO-We"} diff --git a/docs/document/index.html b/docs/document/index.html index 46c358eec..fe5f978e1 100644 --- a/docs/document/index.html +++ b/docs/document/index.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
+    
Skip to content

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -44,7 +44,7 @@
           });
         </script>
     </body>
-</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="artRef"></div>
 </template>
 
@@ -108,7 +108,7 @@
     },
   },
 };
-</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import { useEffect, useRef } from 'react';
+</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import { useEffect, useRef } from 'react';
 import Artplayer from 'artplayer';
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -196,7 +196,7 @@
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.4 开始,artplayer和所有插件还会提供一个ESM版本的js,如:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/dist/artplayer.legacy.js';
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.4 开始,artplayer和所有插件还会提供一个ESM版本的js,如:

  • artplayer/dist/artplayer.esm.js
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
@@ -254,7 +254,7 @@
         </script>
     </body>
 </html>

提示

你需要在引入 Artplayer 依赖前来修改它才会生效

- + \ No newline at end of file diff --git a/docs/document/plugin/danmuku.html b/docs/document/plugin/danmuku.html index d931fd5da..2e7f20f06 100644 --- a/docs/document/plugin/danmuku.html +++ b/docs/document/plugin/danmuku.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
+    
Skip to content

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
     text: '', // 弹幕文本
     time: 10, // 弹幕时间, 默认为当前播放器时间
     mode: 0, // 弹幕模式: 0: 滚动(默认),1: 顶部,2: 底部
@@ -367,7 +367,7 @@
 art.on('artplayerPluginDanmuku:destroy', () => {
     console.info('弹幕销毁');
 });
- + \ No newline at end of file diff --git a/docs/document/start/i18n.html b/docs/document/start/i18n.html index aa20cc98e..db3ca5d5f 100644 --- a/docs/document/start/i18n.html +++ b/docs/document/start/i18n.html @@ -13,7 +13,7 @@ - + @@ -27,7 +27,7 @@ container: '.artplayer-app', url: '/assets/sample/video.mp4', lang: 'zh-cn', // or 'en' -});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
+});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/dist/i18n/id.js';
 import zhTw from 'artplayer/dist/i18n/zh-tw.js';
 
 var art = new Artplayer({
@@ -75,7 +75,7 @@
         },
     },
 });
- + \ No newline at end of file diff --git a/docs/document/start/option.html b/docs/document/start/option.html index de0dd3c06..e151e68cd 100644 --- a/docs/document/start/option.html +++ b/docs/document/start/option.html @@ -411,7 +411,7 @@ url: '/assets/sample/video.mp4', proxy: () => document.createElement('video') });
- + \ No newline at end of file diff --git a/packages/artplayer/types/artplayer.d.ts b/packages/artplayer/types/artplayer.d.ts index 56161c08f..39d48b92a 100644 --- a/packages/artplayer/types/artplayer.d.ts +++ b/packages/artplayer/types/artplayer.d.ts @@ -46,8 +46,8 @@ export default class Artplayer extends Player { static readonly build: string static readonly config: Config static readonly utils: Utils - static readonly scheme: Record - static readonly Emitter: new (...args: any[]) => any + static readonly scheme: Record + static readonly Emitter: new (...args: unknown[]) => unknown static readonly validator: (option: T, scheme: object) => T static readonly kindOf: (item: unknown) => string static readonly html: Artplayer['template']['html'] @@ -104,24 +104,22 @@ export default class Artplayer extends Player { torrent?: unknown on(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): this - on(name: string, fn: (...args: any[]) => unknown, ctx?: object): this + on(name: string, fn: (...args: unknown[]) => unknown, ctx?: object): this once(name: T, fn: (...args: Events[T]) => unknown, ctx?: object): this - once(name: string, fn: (...args: any[]) => unknown, ctx?: object): this + once(name: string, fn: (...args: unknown[]) => unknown, ctx?: object): this emit(name: T, ...args: Events[T]): this - emit(name: string, ...args: any[]): this + emit(name: string, ...args: unknown[]): this off(name: T, callback?: (...args: Events[T]) => unknown): this - off(name: string, callback?: (...args: any[]) => unknown): this + off(name: string, callback?: (...args: unknown[]) => unknown): this query: Artplayer['template']['query'] proxy: Artplayer['events']['proxy'] video: Artplayer['template']['$video'] - e: { - [K in keyof Events]?: { fn: (...args: Events[K]) => any, ctx: unknown }[] - } + e: { [K in keyof Events]?: { fn: (...args: Events[K]) => unknown, ctx: unknown }[] } destroy(removeHtml?: boolean): void @@ -200,8 +198,7 @@ export default class Artplayer extends Player { readonly plugins: { add: ( - plugin: (this: Artplayer, art: Artplayer) => any | Promise, + plugin: (this: Artplayer, art: Artplayer) => unknown | Promise, ) => Promise | Artplayer['plugins'] - [pluginName: string]: any - } + } & Record } diff --git a/packages/artplayer/types/option.d.ts b/packages/artplayer/types/option.d.ts index 05bbbbecb..9723f601d 100644 --- a/packages/artplayer/types/option.d.ts +++ b/packages/artplayer/types/option.d.ts @@ -287,11 +287,11 @@ export interface Option { /** * Other video attribute */ - moreVideoAttr?: Partial<{ - [key in keyof HTMLVideoElement as HTMLVideoElement[key] extends (...args: unknown[]) => unknown + moreVideoAttr?: Partial unknown ? never - : key]: HTMLVideoElement[key] - }> + : K]: HTMLVideoElement[K] + }>> /** * Custom i18n