From aa156e1516bc38a65199d1f742d8ef757dd7d5c6 Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Tue, 7 May 2019 11:12:01 +0800 Subject: [PATCH] Update index.js --- packages/artplayer-plugin-gif/src/index.js | 34 ++++++++++------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/packages/artplayer-plugin-gif/src/index.js b/packages/artplayer-plugin-gif/src/index.js index 1566192cf..0b650b0d5 100644 --- a/packages/artplayer-plugin-gif/src/index.js +++ b/packages/artplayer-plugin-gif/src/index.js @@ -1,7 +1,19 @@ import gifshot from 'gifshot'; import b64toBlob from 'b64-to-blob'; -function i18nMix(i18n) { +function artplayerPluginGif(art) { + const { errorHandle, clamp, downloadImage } = art.constructor.utils; + const { + i18n, + notice, + layers, + player, + loading, + option: { theme, title }, + events: { proxy }, + template: { $video }, + } = art; + i18n.update({ 'zh-cn': { 'Long press, gif length is between 1 second and 10 seconds': '长按,gif 长度为 1 ~ 10 秒', @@ -20,24 +32,8 @@ function i18nMix(i18n) { 'Release the mouse to start': '放開鼠標即可開始', }, }); -} -function artplayerPluginGif(art) { - const { errorHandle, clamp, downloadImage } = art.constructor.utils; - const { - i18n, - notice, - layers, - player, - loading, - option: { theme, title }, - events: { proxy }, - template: { $video }, - } = art; - - i18nMix(i18n); - - layers.add({ + const layer = layers.add({ name: 'artplayer-plugin-gif-progress', style: { position: 'absolute', @@ -49,7 +45,7 @@ function artplayerPluginGif(art) { }, }); - const $progress = layers['artplayer-plugin-gif-progress'].$ref; + const $progress = layer.$ref; const timeLimit = 10000; let isProcessing = false; let pressStartTime = 0;