优化 gif 提示

This commit is contained in:
Harvey Zack committed 2018-12-06 21:44:52 +08:00
1 parent 0eaf9b9b3b
commit f931f0dda2
2 files changed
+6 -11

No files matched your search

+3 -6
View File
@@ -2744,8 +2744,7 @@
var _art$constructor$util = art.constructor.utils, var _art$constructor$util = art.constructor.utils,
errorHandle = _art$constructor$util.errorHandle, errorHandle = _art$constructor$util.errorHandle,
clamp = _art$constructor$util.clamp, clamp = _art$constructor$util.clamp,
downloadImage = _art$constructor$util.downloadImage, downloadImage = _art$constructor$util.downloadImage;
sleep = _art$constructor$util.sleep;
var i18n = art.i18n, var i18n = art.i18n,
notice = art.notice, notice = art.notice,
layers = art.layers, layers = art.layers,
@@ -2801,9 +2800,7 @@
gifHeight: 200, gifHeight: 200,
gifWidth: videoWidth / videoHeight * 200 gifWidth: videoWidth / videoHeight * 200
}, function (image) { }, function (image) {
sleep(100).then(function () { downloadImage(image, "".concat(title || 'unnamed', ".gif"));
downloadImage(image, "".concat(title || 'unnamed', ".gif"));
});
}); });
} }
} }
@@ -2851,7 +2848,7 @@
loading.show(); loading.show();
art.emit('artplayerPluginGif:start'); art.emit('artplayerPluginGif:start');
notice.show(i18n.get('Start creating gif...'), false); notice.show(i18n.get('Start creating gif...'), false);
console.log("Start time: ".concat(config.offset || 0, " s, Duration: ").concat(config.numFrames / 10 || 1)); console.log("Start time: ".concat(config.offset || 0, "s, Frames: ").concat(config.numFrames || 10, "p, Duration: ").concat(config.numFrames / 10 || 1, "s"));
gifshot.createGIF(objectSpread({}, config, { gifshot.createGIF(objectSpread({}, config, {
video: [$video.src], video: [$video.src],
crossOrigin: 'Anonymous' crossOrigin: 'Anonymous'
+3 -5
View File
@@ -22,7 +22,7 @@ function i18nMix(i18n) {
} }
function artplayerPluginGif(art) { function artplayerPluginGif(art) {
const { errorHandle, clamp, downloadImage, sleep } = art.constructor.utils; const { errorHandle, clamp, downloadImage } = art.constructor.utils;
const { const {
i18n, i18n,
notice, notice,
@@ -81,9 +81,7 @@ function artplayerPluginGif(art) {
gifWidth: (videoWidth / videoHeight) * 200, gifWidth: (videoWidth / videoHeight) * 200,
}, },
image => { image => {
sleep(100).then(() => { downloadImage(image, `${title || 'unnamed'}.gif`);
downloadImage(image, `${title || 'unnamed'}.gif`);
});
}, },
); );
} }
@@ -130,7 +128,7 @@ function artplayerPluginGif(art) {
loading.show(); loading.show();
art.emit('artplayerPluginGif:start'); art.emit('artplayerPluginGif:start');
notice.show(i18n.get('Start creating gif...'), false); notice.show(i18n.get('Start creating gif...'), false);
console.log(`Start time: ${config.offset || 0} s, Duration: ${config.numFrames / 10 || 1}`); console.log(`Start time: ${config.offset || 0}s, Frames: ${config.numFrames || 10}p, Duration: ${config.numFrames / 10 || 1}s`);
gifshot.createGIF( gifshot.createGIF(
{ {
...config, ...config,