This commit is contained in:
Harvey committed 2022-02-14 09:49:49 +08:00
1 parent 222f786b88
commit ce677ef602
62 files changed
+245 -224

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
/*!
* artplayer.js v4.3.0
* artplayer.js v4.3.1
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return n(t)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}!function(t,e){void 0===e&&(e={});var r=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}('.art-video-player{zoom:1;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-high-contrast-adjust:none;background-color:#000;color:#eee;direction:ltr;display:flex;font-family:Roboto,Arial,Helvetica,sans-serif;font-size:14px;height:100%;line-height:1.3;margin:0 auto;outline:0;position:relative;text-align:left;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;z-index:20}.art-video-player *{box-sizing:border-box;margin:0;padding:0}.art-video-player ::-webkit-scrollbar{height:5px;width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{align-items:center;display:inline-flex;justify-content:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player img{max-width:100%;vertical-align:top}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}}.art-video-player .art-video{background-color:#000;cursor:pointer;z-index:10}.art-video-player .art-poster,.art-video-player .art-video{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.art-video-player .art-poster{background-position:50%;background-repeat:no-repeat;background-size:cover;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:11}.art-video-player .art-subtitle{bottom:10px;color:#fff;display:none;font-size:20px;padding:0 20px;pointer-events:none;position:absolute;text-align:center;text-shadow:.5px .5px .5px rgba(0,0,0,.5);width:100%;z-index:20}.art-video-player .art-subtitle p{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;line-height:1.2;margin:5px 0 0;word-break:break-all}.art-video-player .art-bilingual p:nth-child(n+2){transform:scale(.6);transform-origin:center top}.art-video-player.art-subtitle-show .art-subtitle{display:block}.art-video-player.art-control-show .art-subtitle{bottom:50px}.art-video-player .art-danmuku{z-index:30}.art-video-player .art-danmuku,.art-video-player .art-layers{bottom:0;height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%}.art-video-player .art-layers{display:none;z-index:40}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:block}.art-video-player .art-mask{align-items:center;bottom:0;display:none;height:100%;justify-content:center;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%;z-index:50}.art-video-player .art-mask .art-state{align-items:center;bottom:65px;display:flex;height:60px;justify-content:center;opacity:.6;position:absolute;right:30px;width:60px}.art-video-player.art-mask-show .art-mask{display:flex}.art-video-player .art-loading{align-items:center;bottom:0;display:none;height:100%;justify-content:center;left:0;pointer-events:nonLine truncated
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return n(t)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}!function(t,e){void 0===e&&(e={});var r=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}('.art-video-player{zoom:1;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-high-contrast-adjust:none;background-color:#000;color:#eee;direction:ltr;display:flex;font-family:Roboto,Arial,Helvetica,sans-serif;font-size:14px;height:100%;line-height:1.3;margin:0 auto;outline:0;position:relative;text-align:left;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;z-index:20}.art-video-player *{box-sizing:border-box;margin:0;padding:0}.art-video-player ::-webkit-scrollbar{height:5px;width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{align-items:center;display:inline-flex;justify-content:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player img{max-width:100%;vertical-align:top}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}}.art-video-player .art-video{background-color:#000;cursor:pointer;z-index:10}.art-video-player .art-poster,.art-video-player .art-video{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}.art-video-player .art-poster{background-position:50%;background-repeat:no-repeat;background-size:cover;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:11}.art-video-player .art-subtitle{bottom:10px;color:#fff;display:none;font-size:20px;padding:0 20px;pointer-events:none;position:absolute;text-align:center;text-shadow:.5px .5px .5px rgba(0,0,0,.5);width:100%;z-index:20}.art-video-player .art-subtitle p{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;line-height:1.2;margin:5px 0 0;word-break:break-all}.art-video-player .art-bilingual p:nth-child(n+2){transform:scale(.6);transform-origin:center top}.art-video-player.art-subtitle-show .art-subtitle{display:block}.art-video-player.art-control-show .art-subtitle{bottom:50px}.art-video-player .art-danmuku{z-index:30}.art-video-player .art-danmuku,.art-video-player .art-layers{bottom:0;height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%}.art-video-player .art-layers{display:none;z-index:40}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:block}.art-video-player .art-mask{align-items:center;bottom:0;display:none;height:100%;justify-content:center;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;width:100%;z-index:50}.art-video-player .art-mask .art-state{align-items:center;bottom:65px;display:flex;height:60px;justify-content:center;opacity:.6;position:absolute;right:30px;width:60px}.art-video-player.art-mask-show .art-mask{display:flex}.art-video-player .art-loadingLine truncated
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "artplayer",
"version": "4.3.0",
"version": "4.3.1",
"expose": "Artplayer",
"description": "ArtPlayer.js is a modern and full featured HTML5 video player",
"main": "dist/artplayer.js",
+1
View File
@@ -21,6 +21,7 @@ export const ComponentOption = {
click: `?${f}`,
mounted: `?${f}`,
tooltip: `?${s}`,
width: `?${n}`,
selector: `?${a}`,
onSelect: `?${f}`,
};
@@ -7,8 +7,8 @@ export default function aspectRatio(art) {
return value === 'default' ? i18n.get('Default') : value;
}
function update($panel, $description, value) {
if ($description) $description.innerText = getI18n(value);
function update($panel, $tooltip, value) {
if ($tooltip) $tooltip.innerText = getI18n(value);
const $current = queryAll('.art-setting-item', $panel).find((item) => item.dataset.value === value);
if ($current) inverseClass($current, 'art-current');
}
@@ -17,7 +17,7 @@ export default function aspectRatio(art) {
width: 200,
html: i18n.get('Aspect Ratio'),
icon: icons.aspectRatio,
description: getI18n(art.aspectRatio),
tooltip: getI18n(art.aspectRatio),
selector: ['default', '4:3', '16:9'].map((item) => {
return {
value: item,
@@ -29,9 +29,9 @@ export default function aspectRatio(art) {
art.aspectRatio = item.value;
},
mounted: ($panel, item) => {
update($panel, item._$description, art.aspectRatio);
update($panel, item._$tooltip, art.aspectRatio);
art.on('aspectRatio', () => {
update($panel, item._$description, art.aspectRatio);
update($panel, item._$tooltip, art.aspectRatio);
});
},
};
+5 -5
View File
@@ -9,8 +9,8 @@ export default function flip(art) {
vertical: 'Vertical',
};
function update($panel, $description, value) {
if ($description) $description.innerText = i18n.get(keys[value]);
function update($panel, $tooltip, value) {
if ($tooltip) $tooltip.innerText = i18n.get(keys[value]);
const $current = queryAll('.art-setting-item', $panel).find((item) => item.dataset.value === value);
if ($current) inverseClass($current, 'art-current');
}
@@ -18,7 +18,7 @@ export default function flip(art) {
return {
width: 200,
html: i18n.get('Video Flip'),
description: i18n.get(keys[art.flip]),
tooltip: i18n.get(keys[art.flip]),
icon: icons.config,
selector: Object.keys(keys).map((item) => {
return {
@@ -31,9 +31,9 @@ export default function flip(art) {
art.flip = item.value;
},
mounted: ($panel, item) => {
update($panel, item._$description, art.flip);
update($panel, item._$tooltip, art.flip);
art.on('flip', () => {
update($panel, item._$description, art.flip);
update($panel, item._$tooltip, art.flip);
});
},
};
+13 -9
View File
@@ -133,13 +133,13 @@ export default class Setting extends Component {
append($left, item.html);
if (hasChildren) {
const $description = document.createElement('div');
addClass($description, 'art-setting-item-right-description');
append($right, $description);
item._$description = $description;
const $tooltip = document.createElement('div');
addClass($tooltip, 'art-setting-item-right-tooltip');
append($right, $tooltip);
item._$tooltip = $tooltip;
if (item.description) {
$description.innerHTML = item.description;
if (item.tooltip) {
$tooltip.innerHTML = item.tooltip;
}
const $iconRight = document.createElement('div');
@@ -160,9 +160,9 @@ export default class Setting extends Component {
if (item._parentItem && item._parentItem.onSelect) {
const result = item._parentItem.onSelect.call(this.art, item, $item, event);
if (item._parentItem._$description) {
if (item._parentItem._$tooltip) {
if (typeof result === 'string' || typeof result === 'number') {
item._parentItem._$description.innerHTML = result;
item._parentItem._$tooltip.innerHTML = result;
}
}
}
@@ -173,7 +173,11 @@ export default class Setting extends Component {
}
add(callback) {
this.option.push(callback(this.art));
if (typeof callback === 'function') {
this.option.push(callback(this.art));
} else {
this.option.push(callback);
}
this.option = makeRecursion(this.option);
this.init(this.option);
}
@@ -7,8 +7,8 @@ export default function playbackRate(art) {
return value === 1.0 ? i18n.get('Normal') : value;
}
function update($panel, $description, value) {
if ($description) $description.innerText = getI18n(value);
function update($panel, $tooltip, value) {
if ($tooltip) $tooltip.innerText = getI18n(value);
const $current = queryAll('.art-setting-item', $panel).find((item) => Number(item.dataset.value) === value);
if ($current) inverseClass($current, 'art-current');
}
@@ -16,7 +16,7 @@ export default function playbackRate(art) {
return {
width: 200,
html: i18n.get('Play Speed'),
description: getI18n(art.playbackRate),
tooltip: getI18n(art.playbackRate),
icon: icons.playbackRate,
selector: [0.5, 0.75, 1.0, 1.25, 1.5, 2.0].map((item) => {
return {
@@ -29,9 +29,9 @@ export default function playbackRate(art) {
art.playbackRate = item.value;
},
mounted: ($panel, item) => {
update($panel, item._$description, art.playbackRate);
update($panel, item._$tooltip, art.playbackRate);
art.on('playbackRate', () => {
update($panel, item._$description, art.playbackRate);
update($panel, item._$tooltip, art.playbackRate);
});
},
};
@@ -7,8 +7,8 @@ export default function subtitleOffset(art) {
return value === 0 ? i18n.get('Normal') : value;
}
function update($panel, $description, value) {
if ($description) $description.innerText = getI18n(value);
function update($panel, $tooltip, value) {
if ($tooltip) $tooltip.innerText = getI18n(value);
const $current = queryAll('.art-setting-item', $panel).find((item) => Number(item.dataset.value) === value);
if ($current) inverseClass($current, 'art-current');
}
@@ -16,7 +16,7 @@ export default function subtitleOffset(art) {
return {
width: 200,
html: i18n.get('Subtitle Offset'),
description: getI18n(art.subtitleOffset),
tooltip: getI18n(art.subtitleOffset),
icon: icons.subtitle,
selector: [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5].map((item) => {
return {
@@ -29,9 +29,9 @@ export default function subtitleOffset(art) {
art.subtitleOffset = item.value;
},
mounted: ($panel, item) => {
update($panel, item._$description, art.subtitleOffset);
update($panel, item._$tooltip, art.subtitleOffset);
art.on('subtitleOffset', () => {
update($panel, item._$description, art.subtitleOffset);
update($panel, item._$tooltip, art.subtitleOffset);
});
},
};
+1 -1
View File
@@ -72,7 +72,7 @@
display: flex;
align-items: center;
.art-setting-item-right-description {
.art-setting-item-right-tooltip {
font-size: 12px;
white-space: nowrap;
color: rgba(255, 255, 255, 0.5);
+6 -1
View File
@@ -86,6 +86,11 @@ type SettingOption = {
*/
width?: number;
/**
* The tooltip of setting
*/
tooltip?: string;
/**
* Whether the default is selected
*/
@@ -701,5 +706,5 @@ declare class Artplayer extends Player {
readonly contextmenu: Record<string, HTMLElement> & Component;
readonly setting: Component;
readonly setting: Record<string, HTMLElement> & Component;
}