From 6deccca9bef193d4424d8f8587f32127beabf6a2 Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Sun, 2 Dec 2018 10:49:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=88=9D=E5=A7=8B=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/uncompiled/artplayer.js | 17 ++++++++++++++--- .../plugins/artplayer-plugin-localPreview.js | 13 ++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/uncompiled/artplayer.js b/docs/uncompiled/artplayer.js index 2b43558f2..d0b207d7d 100644 --- a/docs/uncompiled/artplayer.js +++ b/docs/uncompiled/artplayer.js @@ -5553,12 +5553,15 @@ getExt = _art$constructor$util.getExt, append = _art$constructor$util.append, setStyle = _art$constructor$util.setStyle, - setStyles = _art$constructor$util.setStyles; + 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; + template = art.template, + player = art.player; i18nMix$1(i18n); return { attach: function attach(target) { @@ -5583,7 +5586,15 @@ var ext = getExt(file.name); if (ext && formats.includes(ext)) { - template.$video.src = URL.createObjectURL(file); + 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()); diff --git a/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js b/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js index 244c3a8aa..28356fda0 100644 --- a/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js +++ b/packages/artplayer/src/plugins/artplayer-plugin-localPreview.js @@ -17,15 +17,18 @@ export default function artplayerPluginLocalPreview(art) { append, setStyle, setStyles, + sleep, } = art.constructor.utils; const formats = ['mp4', 'ogg', 'webm']; const { events: { proxy, }, + option, notice, i18n, template, + player, } = art; i18nMix(i18n); @@ -49,7 +52,15 @@ export default function artplayerPluginLocalPreview(art) { } const ext = getExt(file.name); if (ext && formats.includes(ext)) { - template.$video.src = URL.createObjectURL(file); + 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()}`;