mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
添加字幕插件
This commit is contained in:
1 parent
5f384fb04d
commit
1667457188
24 files changed
+492
-247
No files matched your search
@@ -71,6 +71,7 @@ class Artplayer extends Emitter {
|
||||
quality: [],
|
||||
controls: [],
|
||||
highlight: [],
|
||||
plugins: [],
|
||||
thumbnails: {
|
||||
url: '',
|
||||
number: 60,
|
||||
@@ -90,18 +91,6 @@ class Artplayer extends Emitter {
|
||||
};
|
||||
}
|
||||
|
||||
static use(...args) {
|
||||
const plugin = args[0];
|
||||
const installedPlugins = this.plugins || (this.plugins = []);
|
||||
if (installedPlugins.indexOf === -1) {
|
||||
installedPlugins.push(plugin);
|
||||
args.unshift(this);
|
||||
plugin(...args.slice(1));
|
||||
this.prototype.emit('use', plugin);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.isFocus = false;
|
||||
this.isPlaying = false;
|
||||
@@ -136,6 +125,20 @@ class Artplayer extends Emitter {
|
||||
id += 1;
|
||||
this.id = id;
|
||||
Artplayer.instances.push(this);
|
||||
|
||||
this.plugins = [];
|
||||
this.option.plugins.forEach((plugin, index) => {
|
||||
const resule = plugin(this);
|
||||
let pluginName = '';
|
||||
if (resule && resule.name) {
|
||||
pluginName = resule.name;
|
||||
} else if (plugin.name) {
|
||||
pluginName = plugin.name;
|
||||
} else {
|
||||
pluginName = `plugin${index}`;
|
||||
}
|
||||
this.plugins[pluginName] = resule;
|
||||
});
|
||||
}
|
||||
|
||||
destroy(removeHtml = false) {
|
||||
|
||||
Reference in new issue
Block a user