mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 03:11:20 -08:00
采用简单的插件命名
This commit is contained in:
1 parent
5bfe0f7cfb
commit
81a577d4a6
5 files changed
+19
-15
No files matched your search
@@ -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