优化本地文件类型判断

This commit is contained in:
Harvey Zack committed 2018-12-05 14:54:36 +08:00
1 parent 5078533ad8
commit 0e4e3da5ee
3 files changed
+11 -23

No files matched your search

+3 -6
View File
@@ -5551,18 +5551,17 @@
function localPreview(art) {
var _art$constructor$util = art.constructor.utils,
getExt = _art$constructor$util.getExt,
append = _art$constructor$util.append,
setStyle = _art$constructor$util.setStyle,
setStyles = _art$constructor$util.setStyles,
sleep = _art$constructor$util.sleep;
var formats = ['mp4', 'ogg', 'webm'];
var proxy = art.events.proxy,
option = art.option,
notice = art.notice,
i18n = art.i18n,
template = art.template,
player = art.player;
var fileTypes = ['video/mp4', 'audio/ogg', 'video/webm'];
i18nMix$1(i18n);
return {
name: 'localPreview',
@@ -5581,9 +5580,7 @@
var file = $input.files[0];
if (file) {
var ext = getExt(file.name);
if (ext && formats.includes(ext)) {
if (fileTypes.includes(file.type)) {
var url = URL.createObjectURL(file);
player.playbackRateRemove();
player.aspectRatioRemove();
@@ -5595,7 +5592,7 @@
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());
var tip = "".concat(i18n.get('Only file types are supported'), ": ").concat(fileTypes.toString(), ", but got ").concat(file.type);
notice.show(tip, true, 3000);
console.warn(tip);
}