This commit is contained in:
Harvey Zack committed 2018-12-02 10:51:22 +08:00
1 parent 6deccca9be
commit 3e429add87
2 files changed
+36 -41

No files matched your search

+18 -21
View File
@@ -5565,7 +5565,6 @@
i18nMix$1(i18n); i18nMix$1(i18n);
return { return {
attach: function attach(target) { attach: function attach(target) {
console.log(target);
var $input = append(target, '<input type="file">'); var $input = append(target, '<input type="file">');
setStyle(target, 'position', 'relative'); setStyle(target, 'position', 'relative');
setStyles($input, { setStyles($input, {
@@ -5579,27 +5578,25 @@
proxy($input, 'change', function () { proxy($input, 'change', function () {
var file = $input.files[0]; var file = $input.files[0];
if (!file) { if (file) {
return; var ext = getExt(file.name);
}
var ext = getExt(file.name); if (ext && formats.includes(ext)) {
var url = URL.createObjectURL(file);
if (ext && formats.includes(ext)) { player.playbackRateRemove();
var url = URL.createObjectURL(file); player.aspectRatioRemove();
player.playbackRateRemove(); template.$video.src = url;
player.aspectRatioRemove(); sleep(100).then(function () {
template.$video.src = url; player.seek(0);
sleep(100).then(function () { });
player.seek(0); option.url = url;
}); art.emit('switch', url);
option.url = url; notice.show(i18n.get('Load local video successfully'));
art.emit('switch', url); } else {
notice.show(i18n.get('Load local video successfully')); var tip = "".concat(i18n.get('Only file types are supported'), ": ").concat(formats.toString());
} else { notice.show(tip, true, 3000);
var tip = "".concat(i18n.get('Only file types are supported'), ": ").concat(formats.toString()); console.warn(tip);
notice.show(tip, true, 3000); }
console.warn(tip);
} }
}); });
} }
@@ -34,7 +34,6 @@ export default function artplayerPluginLocalPreview(art) {
return { return {
attach(target) { attach(target) {
console.log(target);
const $input = append(target, '<input type="file">'); const $input = append(target, '<input type="file">');
setStyle(target, 'position', 'relative'); setStyle(target, 'position', 'relative');
setStyles($input, { setStyles($input, {
@@ -47,25 +46,24 @@ export default function artplayerPluginLocalPreview(art) {
}); });
proxy($input, 'change', () => { proxy($input, 'change', () => {
const file = $input.files[0]; const file = $input.files[0];
if (!file) { if (file) {
return; const ext = getExt(file.name);
} if (ext && formats.includes(ext)) {
const ext = getExt(file.name); const url = URL.createObjectURL(file);
if (ext && formats.includes(ext)) { player.playbackRateRemove();
const url = URL.createObjectURL(file); player.aspectRatioRemove();
player.playbackRateRemove(); template.$video.src = url;
player.aspectRatioRemove(); sleep(100).then(() => {
template.$video.src = url; player.seek(0);
sleep(100).then(() => { });
player.seek(0); option.url = url;
}); art.emit('switch', url);
option.url = url; notice.show(i18n.get('Load local video successfully'));
art.emit('switch', url); } else {
notice.show(i18n.get('Load local video successfully')); const tip = `${i18n.get('Only file types are supported')}: ${formats.toString()}`;
} else { notice.show(tip, true, 3000);
const tip = `${i18n.get('Only file types are supported')}: ${formats.toString()}`; console.warn(tip);
notice.show(tip, true, 3000); }
console.warn(tip);
} }
}); });
}, },