mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
add attrMix.js
This commit is contained in:
1 parent
1438ce5e82
commit
938e8718bc
12 files changed
+268
-232
No files matched your search
@@ -34,7 +34,6 @@ export default class Plugins {
|
||||
|
||||
add(plugin) {
|
||||
this.id += 1;
|
||||
errorHandle(typeof plugin === 'function', `The Plugins.add() first parameter is not a function`);
|
||||
const result = plugin.call(this, this.art);
|
||||
const pluginName = (result && result.name) || plugin.name || `plugin${this.id}`;
|
||||
errorHandle(!has(this, pluginName), `Cannot add a plugin that already has the same name: ${pluginName}`);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { append, query, setStyle, setStyles, errorHandle } from '../utils';
|
||||
export default function localVideo(art) {
|
||||
const {
|
||||
events: { proxy },
|
||||
template,
|
||||
template: { $video, $player },
|
||||
option,
|
||||
setting,
|
||||
i18n,
|
||||
@@ -11,7 +11,7 @@ export default function localVideo(art) {
|
||||
|
||||
function loadVideo(file) {
|
||||
if (file) {
|
||||
const canPlayType = template.$video.canPlayType(file.type);
|
||||
const canPlayType = $video.canPlayType(file.type);
|
||||
if (canPlayType === 'maybe' || canPlayType === 'probably') {
|
||||
const url = URL.createObjectURL(file);
|
||||
option.title = file.name;
|
||||
@@ -23,13 +23,13 @@ export default function localVideo(art) {
|
||||
}
|
||||
}
|
||||
|
||||
proxy(template.$player, 'dragover', (event) => {
|
||||
proxy($player, 'dragover', (event) => {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
proxy(template.$player, 'drop', (event) => {
|
||||
proxy($player, 'drop', (event) => {
|
||||
event.preventDefault();
|
||||
const file = e.dataTransfer.files[0];
|
||||
const file = event.dataTransfer.files[0];
|
||||
loadVideo(file);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user