diff --git a/docs/uncompiled/artplayer.js b/docs/uncompiled/artplayer.js
index d0b207d7d..7d7574ea9 100644
--- a/docs/uncompiled/artplayer.js
+++ b/docs/uncompiled/artplayer.js
@@ -5565,7 +5565,6 @@
i18nMix$1(i18n);
return {
attach: function attach(target) {
- console.log(target);
var $input = append(target, '');
setStyle(target, 'position', 'relative');
setStyles($input, {
@@ -5579,27 +5578,25 @@
proxy($input, 'change', function () {
var file = $input.files[0];
- if (!file) {
- return;
- }
+ if (file) {
+ var ext = getExt(file.name);
- var ext = getExt(file.name);
-
- if (ext && formats.includes(ext)) {
- var url = URL.createObjectURL(file);
- player.playbackRateRemove();
- player.aspectRatioRemove();
- template.$video.src = url;
- sleep(100).then(function () {
- player.seek(0);
- });
- option.url = url;
- art.emit('switch', url);
- notice.show(i18n.get('Load local video successfully'));
- } else {
- var tip = "".concat(i18n.get('Only file types are supported'), ": ").concat(formats.toString());
- notice.show(tip, true, 3000);
- console.warn(tip);
+ if (ext && formats.includes(ext)) {
+ var url = URL.createObjectURL(file);
+ player.playbackRateRemove();
+ player.aspectRatioRemove();
+ template.$video.src = url;
+ sleep(100).then(function () {
+ player.seek(0);
+ });
+ option.url = url;
+ art.emit('switch', url);
+ notice.show(i18n.get('Load local video successfully'));
+ } else {
+ var tip = "".concat(i18n.get('Only file types are supported'), ": ").concat(formats.toString());
+ notice.show(tip, true, 3000);
+ console.warn(tip);
+ }
}
});
}
diff --git a/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js b/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js
index 28356fda0..72d545a06 100644
--- a/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js
+++ b/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js
@@ -34,7 +34,6 @@ export default function artplayerPluginLocalPreview(art) {
return {
attach(target) {
- console.log(target);
const $input = append(target, '');
setStyle(target, 'position', 'relative');
setStyles($input, {
@@ -47,25 +46,24 @@ export default function artplayerPluginLocalPreview(art) {
});
proxy($input, 'change', () => {
const file = $input.files[0];
- if (!file) {
- return;
- }
- const ext = getExt(file.name);
- if (ext && formats.includes(ext)) {
- const url = URL.createObjectURL(file);
- player.playbackRateRemove();
- player.aspectRatioRemove();
- template.$video.src = url;
- sleep(100).then(() => {
- player.seek(0);
- });
- option.url = url;
- art.emit('switch', url);
- notice.show(i18n.get('Load local video successfully'));
- } else {
- const tip = `${i18n.get('Only file types are supported')}: ${formats.toString()}`;
- notice.show(tip, true, 3000);
- console.warn(tip);
+ if (file) {
+ const ext = getExt(file.name);
+ if (ext && formats.includes(ext)) {
+ const url = URL.createObjectURL(file);
+ player.playbackRateRemove();
+ player.aspectRatioRemove();
+ template.$video.src = url;
+ sleep(100).then(() => {
+ player.seek(0);
+ });
+ option.url = url;
+ art.emit('switch', url);
+ notice.show(i18n.get('Load local video successfully'));
+ } else {
+ const tip = `${i18n.get('Only file types are supported')}: ${formats.toString()}`;
+ notice.show(tip, true, 3000);
+ console.warn(tip);
+ }
}
});
},