mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
采用简单的插件命名
This commit is contained in:
1 parent
5bfe0f7cfb
commit
81a577d4a6
5 files changed
+19
-15
No files matched your search
@@ -109,7 +109,7 @@ var art = new Artplayer({
|
||||
|
||||
art.on('firstCanplay', () => {
|
||||
var preview = document.querySelector('.art-control-preview');
|
||||
art.plugins.artplayerPluginLocalPreview.attach(preview);
|
||||
art.plugins.localPreview.attach(preview);
|
||||
|
||||
art.on('resize', $player => {
|
||||
art.controls.quality.show();
|
||||
|
||||
@@ -5486,7 +5486,7 @@
|
||||
proxy($range, 'change', function () {
|
||||
var value = $range.value;
|
||||
$value.innerText = value;
|
||||
art.plugins.artplayerPluginSubtitle.offset(Number(value));
|
||||
art.plugins.subtitle.offset(Number(value));
|
||||
});
|
||||
art.on('subtitle:switch', function () {
|
||||
$range.value = 0;
|
||||
@@ -5502,7 +5502,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
function artplayerPluginSubtitle(art) {
|
||||
function subtitle$2(art) {
|
||||
var clamp = art.constructor.utils.clamp;
|
||||
var setting = art.setting,
|
||||
notice = art.notice,
|
||||
@@ -5515,6 +5515,7 @@
|
||||
cuesCache = [];
|
||||
});
|
||||
return {
|
||||
name: 'subtitle',
|
||||
offset: function offset(value) {
|
||||
var cues = Array.from(template.$track.track.cues);
|
||||
var time = clamp(value, -5, 5);
|
||||
@@ -5548,7 +5549,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
function artplayerPluginLocalPreview(art) {
|
||||
function localPreview(art) {
|
||||
var _art$constructor$util = art.constructor.utils,
|
||||
getExt = _art$constructor$util.getExt,
|
||||
append = _art$constructor$util.append,
|
||||
@@ -5564,6 +5565,7 @@
|
||||
player = art.player;
|
||||
i18nMix$1(i18n);
|
||||
return {
|
||||
name: 'localPreview',
|
||||
attach: function attach(target) {
|
||||
var $input = append(target, '<input type="file">');
|
||||
setStyle(target, 'position', 'relative');
|
||||
@@ -5587,7 +5589,7 @@
|
||||
player.aspectRatioRemove();
|
||||
template.$video.src = url;
|
||||
sleep(100).then(function () {
|
||||
player.seek(0);
|
||||
player.currentTime = 0;
|
||||
});
|
||||
option.url = url;
|
||||
art.emit('switch', url);
|
||||
@@ -5613,8 +5615,8 @@
|
||||
|
||||
this.art = art;
|
||||
this.id = 0;
|
||||
this.add(artplayerPluginSubtitle);
|
||||
this.add(artplayerPluginLocalPreview);
|
||||
this.add(subtitle$2);
|
||||
this.add(localPreview);
|
||||
art.option.plugins.forEach(function (plugin) {
|
||||
_this.add(plugin);
|
||||
});
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import artplayerPluginSubtitle from './artplayer-plugin-subtitle';
|
||||
import artplayerPluginLocalPreview from './artplayer-plugin-localPreview';
|
||||
import subtitle from './subtitle';
|
||||
import localPreview from './localPreview';
|
||||
|
||||
export default class Plugins {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
this.id = 0;
|
||||
|
||||
this.add(artplayerPluginSubtitle);
|
||||
this.add(artplayerPluginLocalPreview);
|
||||
this.add(subtitle);
|
||||
this.add(localPreview);
|
||||
art.option.plugins.forEach(plugin => {
|
||||
this.add(plugin);
|
||||
});
|
||||
|
||||
+3
-2
@@ -11,7 +11,7 @@ function i18nMix(i18n) {
|
||||
});
|
||||
}
|
||||
|
||||
export default function artplayerPluginLocalPreview(art) {
|
||||
export default function localPreview(art) {
|
||||
const {
|
||||
getExt,
|
||||
append,
|
||||
@@ -33,6 +33,7 @@ export default function artplayerPluginLocalPreview(art) {
|
||||
i18nMix(i18n);
|
||||
|
||||
return {
|
||||
name: 'localPreview',
|
||||
attach(target) {
|
||||
const $input = append(target, '<input type="file">');
|
||||
setStyle(target, 'position', 'relative');
|
||||
@@ -54,7 +55,7 @@ export default function artplayerPluginLocalPreview(art) {
|
||||
player.aspectRatioRemove();
|
||||
template.$video.src = url;
|
||||
sleep(100).then(() => {
|
||||
player.seek(0);
|
||||
player.currentTime = 0;
|
||||
});
|
||||
option.url = url;
|
||||
art.emit('switch', url);
|
||||
+3
-2
@@ -39,7 +39,7 @@ function settingMix(art) {
|
||||
proxy($range, 'change', () => {
|
||||
const { value } = $range;
|
||||
$value.innerText = value;
|
||||
art.plugins.artplayerPluginSubtitle.offset(Number(value));
|
||||
art.plugins.subtitle.offset(Number(value));
|
||||
});
|
||||
|
||||
art.on('subtitle:switch', () => {
|
||||
@@ -57,7 +57,7 @@ function settingMix(art) {
|
||||
};
|
||||
}
|
||||
|
||||
export default function artplayerPluginSubtitle(art) {
|
||||
export default function subtitle(art) {
|
||||
const { clamp } = art.constructor.utils;
|
||||
const { setting, notice, template, i18n } = art;
|
||||
i18nMix(i18n);
|
||||
@@ -69,6 +69,7 @@ export default function artplayerPluginSubtitle(art) {
|
||||
});
|
||||
|
||||
return {
|
||||
name: 'subtitle',
|
||||
offset(value) {
|
||||
const cues = Array.from(template.$track.track.cues);
|
||||
const time = clamp(value, -5, 5);
|
||||
Reference in new issue
Block a user