优化demo

This commit is contained in:
Harvey committed 2019-11-27 16:14:43 +08:00
1 parent a836852e48
commit 06fc487482
14 files changed
+75 -56

No files matched your search

+11
View File
@@ -3,8 +3,19 @@ var art = new Artplayer({
container: '.artplayer-app',
url: url + '/video/your-name.mp4',
autoSize: true,
localVideo: true,
moreVideoAttr: {
crossOrigin: 'anonymous',
},
controls: [
{
name: 'open',
position: 'right',
html: 'Local Video',
mounted: $open => {
art.plugins.localVideo.attach($open);
},
},
],
plugins: [artplayerPluginBacklight],
});
+4 -7
View File
@@ -4,7 +4,7 @@ var art = new Artplayer({
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
title: '【新海诚动画】『秒速5センチメートル』',
autoSize: true,
localPreview: true,
localVideo: true,
moreVideoAttr: {
crossOrigin: 'anonymous',
},
@@ -16,16 +16,13 @@ var art = new Artplayer({
mounted: $gif => {
art.plugins.artplayerPluginGif.attach($gif);
},
style: {
marginRight: '15px'
}
},
{
name: 'open',
position: 'right',
html: 'Local video',
html: 'Local Video',
mounted: $open => {
art.plugins.localPreview.attach($open);
art.plugins.localVideo.attach($open);
},
},
],
@@ -40,4 +37,4 @@ art.on('artplayerPluginGif', image => {
animatedImage.src = image;
$popinner.innerHTML = '';
$popinner.appendChild(animatedImage);
});
});
+11 -10
View File
@@ -18,21 +18,21 @@ var art = new Artplayer({
html: '发送弹幕',
click: () => {
if (window.location.href.includes('code=')) {
art.notice.show('正在登陆中,请稍等!!!');
art.notice.show = '正在登陆中,请稍等!!!';
} else if (!danmuku.isLogin) {
danmuku.login();
} else {
var text = prompt('请输入:', '弹幕内容');
if (!text || !text.trim()) return;
if (text.length >= 20) {
art.notice.show('弹幕字数不能大于20字!!!');
return;
}
if (danmuku.remaining <= 10) {
art.notice.show('接口请求到达上限,请稍后再试!!!');
art.notice.show = '弹幕字数不能大于20字!!!';
return;
}
art.notice.show('弹幕发送中...');
if (danmuku.remaining <= 10) {
art.notice.show = '接口请求到达上限,请稍后再试!!!';
return;
}
art.notice.show = '弹幕发送中...';
danmuku
.send({
text: text,
@@ -40,15 +40,16 @@ var art = new Artplayer({
color: '#' + Math.floor(Math.random() * 0xffffff).toString(16),
})
.then(data => {
art.notice.show(`发送弹幕成功: ${danmuku.remaining} / ${danmuku.limit}`);
art.notice.show = `发送弹幕成功: ${danmuku.remaining} / ${danmuku.limit}`;
art.plugins.artplayerPluginDanmuku.emit({
...data,
mode: 'scroll',
time: art.player.currentTime + 0.2,
border: data.color,
});
}).catch(() => {
art.notice.show(`发送弹幕失败: ${danmuku.remaining} / ${danmuku.limit}`);
})
.catch(() => {
art.notice.show = `发送弹幕失败: ${danmuku.remaining} / ${danmuku.limit}`;
});
}
},
-6
View File
@@ -12,9 +12,6 @@ var art = new Artplayer({
click: () => {
art.plugins.artplayerPluginPlaylist.show();
},
style: {
marginRight: '15px',
},
},
{
name: 'prev',
@@ -23,9 +20,6 @@ var art = new Artplayer({
click: () => {
art.plugins.artplayerPluginPlaylist.prev();
},
style: {
marginRight: '15px',
},
},
{
name: 'next',
+5 -5
View File
@@ -11,11 +11,11 @@
var $popups = document.querySelector('.popups');
var loaddLib = [];
consola.creat({
target: '.console',
size: '100%',
zIndex: 99,
});
// consola.creat({
// target: '.console',
// size: '100%',
// zIndex: 99,
// });
var mirror = CodeMirror($codeMirror, {
lineNumbers: true,
+3 -3
View File
@@ -407,7 +407,7 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var Danmuku =
/*#__PURE__*/
@@ -628,12 +628,12 @@
i18n = _this$art2.i18n;
if (!danmu.text.trim()) {
notice.show(i18n.get('Danmu text cannot be empty'));
notice.show = i18n.get('Danmu text cannot be empty');
return;
}
if (danmu.text.length > this.option.maxlength) {
notice.show("".concat(i18n.get('The length of the danmu does not exceed'), " ").concat(this.option.maxlength));
notice.show = "".concat(i18n.get('The length of the danmu does not exceed'), " ").concat(this.option.maxlength);
return;
}
@@ -1 +1 @@
{"version":3,"file":"artplayer-plugin-danmuku.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../packages/artplayer-plugin-danmuku/src/i18n.js","../../packages/artplayer-plugin-danmuku/src/setting.js","../../packages/artplayer-plugin-danmuku/src/utils.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer-plugin-danmuku/src/bilibili.js","../../packages/artplayer-plugin-danmuku/src/getDanmuTop.js","../../packages/artplayer-plugin-danmuku/src/danmuku.js","../../packages/artplayer-plugin-danmuku/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;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","export default {\n 'zh-cn': {\n 'Danmu opacity': '弹幕透明度',\n 'Danmu speed': '弹幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '弹幕文本不能为空',\n 'The length of the danmu does not exceed': '弹幕文本字数不能超过',\n 'Danmu speed synchronous playback multiple': '弹幕速度同步播放倍数',\n },\n 'zh-tw': {\n 'Danmu opacity': '彈幕透明度',\n 'Danmu speed': '彈幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '彈幕文本不能為空',\n 'The length of the danmu does not exceed': '彈幕文本字數不能超過',\n 'Danmu speed synchronous playback multiple': '彈幕速度同步播放倍數',\n },\n};","export function opacity(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-opacity',\n index: 10,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu opacity')}: <span class=\"art-value\">100</span>%\n </div>\n <div class=\"art-setting-range\">\n <input type=\"range\" value=\"1\" min=\"0.1\" max=\"1\" step=\"0.1\">\n </div>\n `,\n mounted: $setting => {\n const $range = $setting.querySelector('input[type=range]');\n const $value = $setting.querySelector('.art-value');\n proxy($range, 'change', () => {\n const { value } = $range;\n $value.innerText = Number(value) * 100;\n\n art.plugins.artplayerPluginDanmuku.config({\n opacity: Number(value),\n });\n });\n\n art.on('artplayerPluginDanmuku:config', config => {\n if ($range.value !== config.opacity) {\n $range.value = config.opacity;\n $value.innerText = config.opacity * 100;\n }\n });\n },\n };\n}\n\nexport function size(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-size',\n index: 11,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu size')}: <span class=\"art-value\">25</span>px\n </div>\n <div class=\"art-setting-range\">\n <input type=\"range\" value=\"25\" min=\"14\" max=\"30\" step=\"1\">\n </div>\n `,\n mounted: $setting => {\n const $range = $setting.querySelector('input[type=range]');\n const $value = $setting.querySelector('.art-value');\n proxy($range, 'change', () => {\n const { value } = $range;\n $value.innerText = value;\n\n art.plugins.artplayerPluginDanmuku.config({\n fLine truncated
{"version":3,"file":"artplayer-plugin-danmuku.js","sources":["../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/defineProperty.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/classCallCheck.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/createClass.js","../../packages/artplayer-plugin-danmuku/src/i18n.js","../../packages/artplayer-plugin-danmuku/src/setting.js","../../packages/artplayer-plugin-danmuku/src/utils.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/nonIterableRest.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer-plugin-danmuku/src/bilibili.js","../../packages/artplayer-plugin-danmuku/src/getDanmuTop.js","../../packages/artplayer-plugin-danmuku/src/danmuku.js","../../packages/artplayer-plugin-danmuku/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;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","export default {\n 'zh-cn': {\n 'Danmu opacity': '弹幕透明度',\n 'Danmu speed': '弹幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '弹幕文本不能为空',\n 'The length of the danmu does not exceed': '弹幕文本字数不能超过',\n 'Danmu speed synchronous playback multiple': '弹幕速度同步播放倍数',\n },\n 'zh-tw': {\n 'Danmu opacity': '彈幕透明度',\n 'Danmu speed': '彈幕速度',\n 'Danmu size': '弹幕大小',\n 'Danmu text cannot be empty': '彈幕文本不能為空',\n 'The length of the danmu does not exceed': '彈幕文本字數不能超過',\n 'Danmu speed synchronous playback multiple': '彈幕速度同步播放倍數',\n },\n};","export function opacity(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-opacity',\n index: 10,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu opacity')}: <span class=\"art-value\">100</span>%\n </div>\n <div class=\"art-setting-range\">\n <input type=\"range\" value=\"1\" min=\"0.1\" max=\"1\" step=\"0.1\">\n </div>\n `,\n mounted: $setting => {\n const $range = $setting.querySelector('input[type=range]');\n const $value = $setting.querySelector('.art-value');\n proxy($range, 'change', () => {\n const { value } = $range;\n $value.innerText = Number(value) * 100;\n\n art.plugins.artplayerPluginDanmuku.config({\n opacity: Number(value),\n });\n });\n\n art.on('artplayerPluginDanmuku:config', config => {\n if ($range.value !== config.opacity) {\n $range.value = config.opacity;\n $value.innerText = config.opacity * 100;\n }\n });\n },\n };\n}\n\nexport function size(art) {\n const {\n i18n,\n events: { proxy },\n } = art;\n\n return {\n name: 'danmuku-size',\n index: 11,\n html: `\n <div class=\"art-setting-header\">\n ${i18n.get('Danmu size')}: <span class=\"art-value\">25</span>px\n </div>\n <div class=\"art-setting-range\">\n <input type=\"range\" value=\"25\" min=\"14\" max=\"30\" step=\"1\">\n </div>\n `,\n mounted: $setting => {\n const $range = $setting.querySelector('input[type=range]');\n const $value = $setting.querySelector('.art-value');\n proxy($range, 'change', () => {\n Line truncated
+12 -10
View File
@@ -2878,7 +2878,7 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function artplayerPluginGif(art) {
var _art$constructor$util = art.constructor.utils,
@@ -2913,7 +2913,8 @@
'Release the mouse to start': '放開鼠標即可開始'
}
});
var layer = layers.add({
var $progress = null;
layers.add({
name: 'artplayer-plugin-gif-progress',
style: {
position: 'absolute',
@@ -2923,8 +2924,9 @@
width: '0%',
'background-color': theme
}
}, function ($ref) {
$progress = $ref;
});
var $progress = layer.$ref;
var timeLimit = 10000;
var isProcessing = false;
var pressStartTime = 0;
@@ -2948,9 +2950,9 @@
var pressTime = new Date() - pressStartTime;
if (isProcessing) {
notice.show(i18n.get('There is another gif in the processing'));
notice.show = i18n.get('There is another gif in the processing');
} else if (pressTime < 1000) {
notice.show(i18n.get('Gif time is too short'));
notice.show = i18n.get('Gif time is too short');
} else {
var numFrames = Math.floor(clamp(pressTime, 1000, timeLimit) / 100);
var videoWidth = $video.videoWidth,
@@ -2974,7 +2976,7 @@
cleanTimer();
offset = player.currentTime;
pressStartTime = new Date();
notice.show(i18n.get('Long press, gif length is between 1 second and 10 seconds'));
notice.show = i18n.get('Long press, gif length is between 1 second and 10 seconds');
(function loop() {
progressTimer = setTimeout(function () {
@@ -2984,7 +2986,7 @@
$progress.style.width = "".concat(width + 1, "%");
loop();
} else {
notice.show(i18n.get('Release the mouse to start'));
notice.show = i18n.get('Release the mouse to start');
}
}, timeLimit / 100);
})();
@@ -3003,19 +3005,19 @@
isProcessing = true;
loading.show = true;
art.emit('artplayerPluginGif:start');
notice.show(i18n.get('Start creating gif...'), false);
notice.show = i18n.get('Start creating gif...');
gifshot.createGIF(_objectSpread({}, config, {
video: [$video.src],
crossOrigin: 'anonymous'
}), function (obj) {
if (obj.error) {
notice.show(obj.errorMsg);
notice.show = obj.errorMsg;
errorHandle(false, obj.errorMsg);
} else if (typeof callback === 'function') {
var base64String = obj.image.split(',')[1];
var blob = b64toBlob(base64String, 'image/gif');
var blobUrl = URL.createObjectURL(blob);
notice.show(i18n.get('Create gif successfully'));
notice.show = i18n.get('Create gif successfully');
art.emit('artplayerPluginGif', blobUrl);
callback(blobUrl);
}
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"artplayer-plugin-gif.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.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;","/*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 enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);\n }\n\n return output;\n };\n\n return btoa ? btoa.bind(window) : utils.noop;\n }(),\n isObject: function isObject(obj) {\n return obj && Object.prototype.toString.call(obj) === '[object Object]';\n },\n isEmptyObject: function isEmptyObject(obj) {\n return utils.isObject(obj) && !Object.keys(obj).length;\n },\n isArray: function isArray(arr) {\n return arr && Array.isArray(arr);\n },\n isFunction:Line truncated
{"version":3,"file":"artplayer-plugin-gif.js","sources":["../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/defineProperty.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;","/*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 enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);\n }\n\n return output;\n };\n\n return btoa ? btoa.bind(window) : utils.noop;\n }(),\n isObject: function isObject(obj) {\n return obj && Object.prototype.toString.call(obj) === '[object Object]';\n },\n isEmptyObject: function isEmptyObject(obj) {\n return utils.isObject(obj) && !Object.keys(obj).length;\n },\n isArray: function isArray(arr) {\n return arr && Array.isArray(arr);\n Line truncated
@@ -31,7 +31,12 @@
function switchUrl(index) {
var itemOption = playlist[index];
var isPlaying = player.playing;
return player.switchUrl(itemOption.url, itemOption.title).then(function () {
if (isPlaying) {
player.play = true;
}
art.emit('artplayerPluginPlaylist:change', itemOption);
});
}
@@ -1 +1 @@
{"version":3,"file":"artplayer-plugin-playlist.js","sources":["../../packages/artplayer-plugin-playlist/src/index.js"],"sourcesContent":["import './index.scss';\n\nfunction artplayerPluginPlaylist(list) {\n return art => {\n const {\n utils: { append, errorHandle, sleep, inverseClass },\n } = art.constructor;\n const {\n player,\n events: { proxy },\n template: { $player, $video },\n } = art;\n\n const $playlist = append(\n $player,\n `\n <div class=\"art-playlist\">\n <div class=\"art-playlist-inner art-backdrop-filter\"></div>\n </div>\n `,\n );\n\n errorHandle(Array.isArray(list), 'Playlist is not an array type');\n errorHandle(list.length > 0, 'Playlist cannot be empty');\n const playlist = list.map(item => {\n errorHandle(item.url, 'Playlist items require url attribute');\n errorHandle(item.title, 'Playlist items require title attribute');\n return item;\n });\n\n const $playlistInner = $playlist.querySelector('.art-playlist-inner');\n $playlistInner.innerHTML = playlist\n .map((item, index) => {\n return `<div class=\"art-playlist-item\" data-option-index=\"${index}\">${item.title}</div>`;\n })\n .join('');\n\n function switchUrl(index) {\n const itemOption = playlist[index];\n return player.switchUrl(itemOption.url, itemOption.title).then(() => {\n art.emit('artplayerPluginPlaylist:change', itemOption);\n });\n }\n\n function prevVideo() {\n const index = playlist.findIndex(item => item.url === $video.src);\n errorHandle(index !== -1, \"Can't find Playlist item\");\n if (playlist.length === 1) {\n return switchUrl(0);\n }\n const prevIndex = index - 1 === -1 ? playlist.length - 1 : index - 1;\n return switchUrl(prevIndex);\n }\n\n function nextVideo() {\n const index = playlist.findIndex(item => item.url === $video.src);\n errorHandle(index !== -1, \"Can't find Playlist item\");\n if (playlist.length === 1) {\n return switchUrl(0);\n }\n const nextIndex = index + 1 === playlist.length ? 0 : index + 1;\n return switchUrl(nextIndex);\n }\n\n proxy($playlistInner, 'click', e => {\n const { optionIndex } = e.target.dataset;\n if (optionIndex && Number(optionIndex) <= playlist.length - 1) {\n switchUrl(optionIndex);\n }\n });\n\n proxy($playlist, 'click', e => {\n if (e.target === $playlist) {\n $player.classList.remove('art-playlist-show');\n }\n });\n\n art.on('video:ended', () => {\n nextVideo().then(() => {\n sleep(1000).then(() => {\n player.play = true;\n });\n });\n });\n\n art.on('afterAttachUrl', () => {\n const index = playlist.findIndex(item => item.url === $video.src);\n const $item = Array.from($playlistInner.children)[index];\n if (index !== -1 && $item) {\n inverseClass($item, 'active');\n }\n });\n\n return {\n name: 'artplayerPluginPlaylist',\n show() {\n $player.classList.add('art-playlist-show');\n },\n hide() {\n $player.classList.remove('art-playlist-show');\n },\n next() {\n nextVideo();\n },\n prev() {\n prevVideo();\n },\n };\n };\n}\n\nexport default artplayerPluginPlaylist;\n"],"names":["artplayerPluginPlaylist","list","art","constructor","utils","append","errorHandle","sleep","inverseClass","player","proxy","events","template","$player","$video","$playlist","Array","isArray","length","playlist","map","item","url","title","$playlistInner","querySelector","innerHTML","index","join","switchUrl","itemOption","then","emit","prevVideo","findIndex","src","prevIndex","nextVideo","nextIndex","e","optionIndex","target","dataset","Number","classList","remove","on","play","$item","from","children","name","show","add","hide","next","prev"],"mappings":";;;;;;IAEA,SAASA,uBAAT,CAAiCC,IAAjC,EAAuC;IACnC,SAAO,UAAAC,GAAG,EAAI;IAAA,gCAGNA,GAAG,CAACC,WAHE,CAENC,KAFM;IAAA,QAEGC,MAFH,yBAEGA,MAFH;IAAA,QAEWC,WAFX,yBAEWA,WAFX;IAAA,QAEwBC,KAFxB,yBAEwBA,KAFxB;IAAA,QAE+BC,YAF/B,yBAE+BA,YAF/B;IAAA,QAKNC,MALM,GAQNP,GARM,CAKNO,MALM;IAAA,QAMIC,KANJ,GAQNR,GARM,CAMNS,MANM,CAMID,KANJ;IAAA,wBAQNR,GARM,CAONU,QAPM;IAAA,QAOMC,OAPN,iBAOMA,OAPN;IAAA,QAOeC,MAPf,iBAOeA,MAPf;IAUV,QAAMC,SAAS,GAAGV,MAAM,CACpBQ,OADoB,2JAAxB;IASAP,IAAAA,WAAW,CAACU,KAAK,CAACC,OAAN,CAAchLine truncated
{"version":3,"file":"artplayer-plugin-playlist.js","sources":["../../packages/artplayer-plugin-playlist/src/index.js"],"sourcesContent":["import './index.scss';\n\nfunction artplayerPluginPlaylist(list) {\n return art => {\n const {\n utils: { append, errorHandle, sleep, inverseClass },\n } = art.constructor;\n const {\n player,\n events: { proxy },\n template: { $player, $video },\n } = art;\n\n const $playlist = append(\n $player,\n `\n <div class=\"art-playlist\">\n <div class=\"art-playlist-inner art-backdrop-filter\"></div>\n </div>\n `,\n );\n\n errorHandle(Array.isArray(list), 'Playlist is not an array type');\n errorHandle(list.length > 0, 'Playlist cannot be empty');\n const playlist = list.map(item => {\n errorHandle(item.url, 'Playlist items require url attribute');\n errorHandle(item.title, 'Playlist items require title attribute');\n return item;\n });\n\n const $playlistInner = $playlist.querySelector('.art-playlist-inner');\n $playlistInner.innerHTML = playlist\n .map((item, index) => {\n return `<div class=\"art-playlist-item\" data-option-index=\"${index}\">${item.title}</div>`;\n })\n .join('');\n\n function switchUrl(index) {\n const itemOption = playlist[index];\n const isPlaying = player.playing;\n return player.switchUrl(itemOption.url, itemOption.title).then(() => {\n if (isPlaying) {\n player.play = true;\n }\n art.emit('artplayerPluginPlaylist:change', itemOption);\n });\n }\n\n function prevVideo() {\n const index = playlist.findIndex(item => item.url === $video.src);\n errorHandle(index !== -1, \"Can't find Playlist item\");\n if (playlist.length === 1) {\n return switchUrl(0);\n }\n const prevIndex = index - 1 === -1 ? playlist.length - 1 : index - 1;\n return switchUrl(prevIndex);\n }\n\n function nextVideo() {\n const index = playlist.findIndex(item => item.url === $video.src);\n errorHandle(index !== -1, \"Can't find Playlist item\");\n if (playlist.length === 1) {\n return switchUrl(0);\n }\n const nextIndex = index + 1 === playlist.length ? 0 : index + 1;\n return switchUrl(nextIndex);\n }\n\n proxy($playlistInner, 'click', e => {\n const { optionIndex } = e.target.dataset;\n if (optionIndex && Number(optionIndex) <= playlist.length - 1) {\n switchUrl(optionIndex);\n }\n });\n\n proxy($playlist, 'click', e => {\n if (e.target === $playlist) {\n $player.classList.remove('art-playlist-show');\n }\n });\n\n art.on('video:ended', () => {\n nextVideo().then(() => {\n sleep(1000).then(() => {\n player.play = true;\n });\n });\n });\n\n art.on('afterAttachUrl', () => {\n const index = playlist.findIndex(item => item.url === $video.src);\n const $item = Array.from($playlistInner.children)[index];\n if (index !== -1 && $item) {\n inverseClass($item, 'active');\n }\n });\n\n return {\n name: 'artplayerPluginPlaylist',\n show() {\n $player.classList.add('art-playlist-show');\n },\n hide() {\n $player.classList.remove('art-playlist-show');\n },\n next() {\n nextVideo();\n },\n prev() {\n prevVideo();\n },\n };\n };\n}\n\nexport default artplayerPluginPlaylist;\n"],"names":["artplayerPluginPlaylist","list","art","constructor","utils","append","errorHandle","sleep","inverseClass","player","proxy","events","template","$player","$video","$playlist","Array","isArray","length","playlist","map","item","url","title","$playlistInner","querySelector","innerHTML","index","join","switchUrl","itemOption","isPlaying","playing","then","play","emit","prevVideo","findIndex","src","prevIndex","nextVideo","nextIndex","e","optionIndex","target","dataset","Number","classList","remove","on","$item","from","children","name","show","add","hide","next","prev"],"mappings":";;;;;;IAEA,SAASA,uBAAT,CAAiCC,IAAjC,EAAuC;IACnC,SAAO,UAAAC,GAAG,EAAI;IAAA,gCAGNA,GAAG,CAACC,WAHE,CAENC,KAFM;IAAA,QAEGC,MAFH,yBAEGA,MAFH;IAAA,QAEWC,WAFX,yBAEWA,WAFX;IAAA,QAEwBC,KAFxB,yBAEwBA,KAFxB;IAAA,QAE+BC,YAF/B,yBAE+BA,YAF/B;IAAA,QAKNC,MALM,GAQNP,GARM,CAKNO,MALM;IAAA,QAMIC,KANJ,GAQNR,GARM,CAMNS,MANM,CAMID,KANJ;IAAA,wBAQNR,Line truncated
@@ -1 +1 @@
{"version":3,"file":"artplayer-tool-thumbnail.js","sources":["../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../packages/artplayer-tool-thumbnail/node_modules/tiny-emitter/index.js","../../packages/artplayer-tool-thumbnail/src/utils.js","../../packages/artplayer-tool-thumbnail/src/index.js"],"sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n Line truncated
{"version":3,"file":"artplayer-tool-thumbnail.js","sources":["../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/classCallCheck.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/createClass.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/typeof.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/inherits.js","../../packages/artplayer-tool-thumbnail/node_modules/tiny-emitter/index.js","../../packages/artplayer-tool-thumbnail/src/utils.js","../../packages/artplayer-tool-thumbnail/src/index.js"],"sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((tLine truncated
+16 -11
View File
@@ -33,19 +33,24 @@ function artplayerPluginGif(art) {
},
});
const layer = layers.add({
name: 'artplayer-plugin-gif-progress',
style: {
position: 'absolute',
top: '0',
left: '0',
height: '3px',
width: '0%',
'background-color': theme,
let $progress = null;
layers.add(
{
name: 'artplayer-plugin-gif-progress',
style: {
position: 'absolute',
top: '0',
left: '0',
height: '3px',
width: '0%',
'background-color': theme,
},
},
});
$ref => {
$progress = $ref;
},
);
const $progress = layer.$ref;
const timeLimit = 10000;
let isProcessing = false;
let pressStartTime = 0;
@@ -37,7 +37,11 @@ function artplayerPluginPlaylist(list) {
function switchUrl(index) {
const itemOption = playlist[index];
const isPlaying = player.playing;
return player.switchUrl(itemOption.url, itemOption.title).then(() => {
if (isPlaying) {
player.play = true;
}
art.emit('artplayerPluginPlaylist:change', itemOption);
});
}