mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-10 04:36:15 -08:00
修复 gif demo 错误
This commit is contained in:
1 parent
52b6693da2
commit
dc8337dc65
5 files changed
+26
-30
No files matched your search
@@ -11,7 +11,7 @@ var art = new Artplayer({
|
||||
{
|
||||
name: 'gif',
|
||||
position: 'right',
|
||||
html: '创建GIF',
|
||||
html: 'Create GIF',
|
||||
mounted: $gif => {
|
||||
art.plugins.artplayerPluginGif.attach($gif);
|
||||
},
|
||||
@@ -22,7 +22,7 @@ var art = new Artplayer({
|
||||
{
|
||||
name: 'open',
|
||||
position: 'right',
|
||||
html: '本地视频',
|
||||
html: 'Local video',
|
||||
mounted: $open => {
|
||||
art.plugins.localPreview.attach($open);
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ var art = new Artplayer({
|
||||
{
|
||||
name: 'playlist',
|
||||
position: 'right',
|
||||
html: '播放列表',
|
||||
html: 'Playlist',
|
||||
click: () => {
|
||||
art.plugins.artplayerPluginPlaylist.show();
|
||||
},
|
||||
@@ -19,7 +19,7 @@ var art = new Artplayer({
|
||||
{
|
||||
name: 'prev',
|
||||
position: 'right',
|
||||
html: '上一个',
|
||||
html: 'Prev',
|
||||
click: () => {
|
||||
art.plugins.artplayerPluginPlaylist.prev();
|
||||
},
|
||||
@@ -30,7 +30,7 @@ var art = new Artplayer({
|
||||
{
|
||||
name: 'next',
|
||||
position: 'right',
|
||||
html: '下一个',
|
||||
html: 'Next',
|
||||
click: () => {
|
||||
art.plugins.artplayerPluginPlaylist.next();
|
||||
},
|
||||
|
||||
@@ -2897,7 +2897,21 @@
|
||||
}));
|
||||
});
|
||||
|
||||
function i18nMix(i18n) {
|
||||
function artplayerPluginGif(art) {
|
||||
var _art$constructor$util = art.constructor.utils,
|
||||
errorHandle = _art$constructor$util.errorHandle,
|
||||
clamp = _art$constructor$util.clamp,
|
||||
downloadFile = _art$constructor$util.downloadFile;
|
||||
var i18n = art.i18n,
|
||||
notice = art.notice,
|
||||
layers = art.layers,
|
||||
player = art.player,
|
||||
loading = art.loading,
|
||||
_art$option = art.option,
|
||||
theme = _art$option.theme,
|
||||
title = _art$option.title,
|
||||
proxy = art.events.proxy,
|
||||
$video = art.template.$video;
|
||||
i18n.update({
|
||||
'zh-cn': {
|
||||
'Long press, gif length is between 1 second and 10 seconds': '长按,gif 长度为 1 ~ 10 秒',
|
||||
@@ -2916,25 +2930,7 @@
|
||||
'Release the mouse to start': '放開鼠標即可開始'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function artplayerPluginGif(art) {
|
||||
var _art$constructor$util = art.constructor.utils,
|
||||
errorHandle = _art$constructor$util.errorHandle,
|
||||
clamp = _art$constructor$util.clamp,
|
||||
downloadImage = _art$constructor$util.downloadImage;
|
||||
var i18n = art.i18n,
|
||||
notice = art.notice,
|
||||
layers = art.layers,
|
||||
player = art.player,
|
||||
loading = art.loading,
|
||||
_art$option = art.option,
|
||||
theme = _art$option.theme,
|
||||
title = _art$option.title,
|
||||
proxy = art.events.proxy,
|
||||
$video = art.template.$video;
|
||||
i18nMix(i18n);
|
||||
layers.add({
|
||||
var layer = layers.add({
|
||||
name: 'artplayer-plugin-gif-progress',
|
||||
style: {
|
||||
position: 'absolute',
|
||||
@@ -2945,7 +2941,7 @@
|
||||
'background-color': theme
|
||||
}
|
||||
});
|
||||
var $progress = layers['artplayer-plugin-gif-progress'].$ref;
|
||||
var $progress = layer.$ref;
|
||||
var timeLimit = 10000;
|
||||
var isProcessing = false;
|
||||
var pressStartTime = 0;
|
||||
@@ -2982,7 +2978,7 @@
|
||||
gifHeight: 200,
|
||||
gifWidth: videoWidth / videoHeight * 200
|
||||
}, function (image) {
|
||||
downloadImage(image, "".concat(title || 'unnamed', ".gif"));
|
||||
downloadFile(image, "".concat(title || 'unnamed', ".gif"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"artplayer-plugin-gif.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../packages/artplayer-plugin-gif/node_modules/gifshot/dist/gifshot.js","../../packages/artplayer-plugin-gif/node_modules/b64-to-blob/b64toBlob.js","../../packages/artplayer-plugin-gif/src/index.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","var defineProperty = require(\"./defineProperty\");\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread;","/*Copyrights for code authored by Yahoo Inc. is licensed under the following terms:\nMIT License\nCopyright 2017 Yahoo Inc.\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n;(function(window, document, navigator, undefined) {\n\"use strict\";\n\n/*\n utils.js\n ========\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nvar utils = {\n URL: window.URL || window.webkitURL || window.mozURL || window.msURL,\n getUserMedia: function () {\n var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n\n return getUserMedia ? getUserMedia.bind(navigator) : getUserMedia;\n }(),\n requestAnimFrame: window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame,\n requestTimeout: function requestTimeout(callback, delay) {\n callback = callback || utils.noop;\n delay = delay || 0;\n\n if (!utils.requestAnimFrame) {\n return setTimeout(callback, delay);\n }\n\n var start = new Date().getTime();\n var handle = new Object();\n var requestAnimFrame = utils.requestAnimFrame;\n\n var loop = function loop() {\n var current = new Date().getTime();\n var delta = current - start;\n\n delta >= delay ? callback.call() : handle.value = requestAnimFrame(loop);\n };\n\n handle.value = requestAnimFrame(loop);\n\n return handle;\n },\n Blob: window.Blob || window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder,\n btoa: function () {\n var btoa = window.btoa || function (input) {\n var output = '';\n var i = 0;\n var l = input.length;\n var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var chr1 = void 0;\n var chr2 = void 0;\n var chr3 = void 0;\n var enc1 = void 0;\n var enc2 = void 0;\n var enc3 = void 0;\n var enc4 = void 0;\n\n while (i < l) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n Line truncated
|
||||
{"version":3,"file":"artplayer-plugin-gif.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../packages/artplayer-plugin-gif/node_modules/gifshot/dist/gifshot.js","../../packages/artplayer-plugin-gif/node_modules/b64-to-blob/b64toBlob.js","../../packages/artplayer-plugin-gif/src/index.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","var defineProperty = require(\"./defineProperty\");\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread;","/*Copyrights for code authored by Yahoo Inc. is licensed under the following terms:\nMIT License\nCopyright 2017 Yahoo Inc.\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n;(function(window, document, navigator, undefined) {\n\"use strict\";\n\n/*\n utils.js\n ========\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nvar utils = {\n URL: window.URL || window.webkitURL || window.mozURL || window.msURL,\n getUserMedia: function () {\n var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n\n return getUserMedia ? getUserMedia.bind(navigator) : getUserMedia;\n }(),\n requestAnimFrame: window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame,\n requestTimeout: function requestTimeout(callback, delay) {\n callback = callback || utils.noop;\n delay = delay || 0;\n\n if (!utils.requestAnimFrame) {\n return setTimeout(callback, delay);\n }\n\n var start = new Date().getTime();\n var handle = new Object();\n var requestAnimFrame = utils.requestAnimFrame;\n\n var loop = function loop() {\n var current = new Date().getTime();\n var delta = current - start;\n\n delta >= delay ? callback.call() : handle.value = requestAnimFrame(loop);\n };\n\n handle.value = requestAnimFrame(loop);\n\n return handle;\n },\n Blob: window.Blob || window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder,\n btoa: function () {\n var btoa = window.btoa || function (input) {\n var output = '';\n var i = 0;\n var l = input.length;\n var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var chr1 = void 0;\n var chr2 = void 0;\n var chr3 = void 0;\n var enc1 = void 0;\n var enc2 = void 0;\n var enc3 = void 0;\n var enc4 = void 0;\n\n while (i < l) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n Line truncated
|
||||
@@ -2,7 +2,7 @@ import gifshot from 'gifshot';
|
||||
import b64toBlob from 'b64-to-blob';
|
||||
|
||||
function artplayerPluginGif(art) {
|
||||
const { errorHandle, clamp, downloadImage } = art.constructor.utils;
|
||||
const { errorHandle, clamp, downloadFile } = art.constructor.utils;
|
||||
const {
|
||||
i18n,
|
||||
notice,
|
||||
@@ -83,7 +83,7 @@ function artplayerPluginGif(art) {
|
||||
gifWidth: (videoWidth / videoHeight) * 200,
|
||||
},
|
||||
image => {
|
||||
downloadImage(image, `${title || 'unnamed'}.gif`);
|
||||
downloadFile(image, `${title || 'unnamed'}.gif`);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user