mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
refactor(core): [CORE-20] type entry and converge initialization
This commit is contained in:
1 parent
ccf77c4ed2
commit
ee895a558f
100 files changed
+33854
-839
No files matched your search
@@ -67,4 +67,4 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};var n=(e||(e=1,r.exports=function(){function t(e){return(t="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})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===n(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(n(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return i(t,e,n),a(t,e,n),function(t,e,n){var s=r(e),l=r(t);if("object"===s){if("object"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'object' type, but got '").concat(l,"'"));Object.keys(e).forEach(function(r){var s=t[r],l=e[r],c=n.slice();c.push(r),i(s,l,c),a(s,l,c),o(s,l,c)})}if("array"===s){if("array"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'array' type, but got '").concat(l,"'"));t.forEach(function(r,s){var l=t[s],c=e[s]||e[0],d=n.slice();d.push(s),i(l,c,d),a(l,c,d),o(l,c,d)})}}(t,e,n),t}function i(t,e,n){if("string"===r(e)){var o=r(t);if("?"===e[0]&&(e=e.slice(1)+"|undefined"),!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return o===t}):e.toLowerCase().trim()===o))throw new Error("[Type Error]: '".concat(n.join("."),"' require '").concat(e,"' type, but got '").concat(o,"'"))}}function a(t,e,n){if("function"===r(e)){var o=e(t,r(t),n);if(!0!==o){var i=r(o);throw"string"===i?new Error(o):"error"===i?o:new Error("[Validator Error]: The scheme for '".concat(n.join("."),"' validator require return true, but got '").concat(o,"'"))}}}return o.kindOf=r,o}()),r.exports);const o=t(n),i="5.4.1",a={properties:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],prototypes:["width","height","videoWidth","videoHeight","poster","webkitDecodedFrameCount","webkitDroppedFrameCount","playsInline","webLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};var n=(e||(e=1,r.exports=function(){function t(e){return(t="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})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===n(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(n(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return i(t,e,n),a(t,e,n),function(t,e,n){var s=r(e),l=r(t);if("object"===s){if("object"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'object' type, but got '").concat(l,"'"));Object.keys(e).forEach(function(r){var s=t[r],l=e[r],c=n.slice();c.push(r),i(s,l,c),a(s,l,c),o(s,l,c)})}if("array"===s){if("array"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'array' type, but got '").concat(l,"'"));t.forEach(function(r,s){var l=t[s],c=e[s]||e[0],d=n.slice();d.push(s),i(l,c,d),a(l,c,d),o(l,c,d)})}}(t,e,n),t}function i(t,e,n){if("string"===r(e)){var o=r(t);if("?"===e[0]&&(e=e.slice(1)+"|undefined"),!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return o===t}):e.toLowerCase().trim()===o))throw new Error("[Type Error]: '".concat(n.join("."),"' require '").concat(e,"' type, but got '").concat(o,"'"))}}function a(t,e,n){if("function"===r(e)){var o=e(t,r(t),n);if(!0!==o){var i=r(o);throw"string"===i?new Error(o):"error"===i?o:new Error("[Validator Error]: The scheme for '".concat(n.join("."),"' validator require return true, but got '").concat(o,"'"))}}}return o.kindOf=r,o}()),r.exports);const o=t(n),i="5.4.1";function a(t,e){let r=document.getElementById(t);r||(r=document.createElement("style"),r.id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(r)}):(document.head||document.documentElement).appendChild(r)),r.textContent=e}const s=globalThis.CUSTOM_USER_AGENT??("undefined"===typeof navigator?"":navigator.userAgent),l=/^(?:(?!chrome|android).)*safari/i.test(s),c=/iPad|iPhone|iPod/i.test(s)&&("undefined"===typeof window||!window.MSStream),d=c||s.includes("Macintosh")&&"undefined"!==typeof navigator&&navigator.maxTouchPoints>=1,p=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(s)||d,u="undefined"!==typeof window&&"undefined"!==typeof document;const h={properties:["audioTracks","autoplay","buffered","controller","controlLine truncated
|
||||
@@ -67,4 +67,4 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";var t,e=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,l=(t,e)=>{for(var r in e||(e={}))i.call(e,r)&&s(t,r,e[r]);if(o)for(var r of o(e))a.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,n(e)),d=(t,e,r)=>new Promise((n,o)=>{var i=t=>{try{s(r.next(t))}catch(e){o(e)}},a=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(i,a);s((r=r.apply(t,e)).next())});function u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var p,h={exports:{}};var f=(p||(p=1,h.exports=function(){function t(e){return(t="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})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===n(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(n(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return i(t,e,n),a(t,e,n),function(t,e,n){var s=r(e),l=r(t);if("object"===s){if("object"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'object' type, but got '").concat(l,"'"));Object.keys(e).forEach(function(r){var s=t[r],l=e[r],c=n.slice();c.push(r),i(s,l,c),a(s,l,c),o(s,l,c)})}if("array"===s){if("array"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'array' type, but got '").concat(l,"'"));t.forEach(function(r,s){var l=t[s],c=e[s]||e[0],d=n.slice();d.push(s),i(l,c,d),a(l,c,d),o(l,c,d)})}}(t,e,n),t}function i(t,e,n){if("string"===r(e)){var o=r(t);if("?"===e[0]&&(e=e.slice(1)+"|undefined"),!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return o===t}):e.toLowerCase().trim()===o))throw new Error("[Type Error]: '".concat(n.join("."),"' require '").concat(e,"' type, but got '").concat(o,"'"))}}function a(t,e,n){if("function"===r(e)){var o=e(t,r(t),n);if(!0!==o){var i=r(o);throw"string"===i?new Error(o):"error"===i?o:new Error("[Validator Error]: The scheme for '".concat(n.join("."),"' validator require return true, but got '").concat(o,"'"))}}}return o.kindOf=r,o}()),h.exports);const m=u(f),g="5.4.1",v={properties:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","meLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(e,r,n)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,s=(t,e)=>{for(var r in e||(e={}))o.call(e,r)&&a(t,r,e[r]);if(n)for(var r of n(e))i.call(e,r)&&a(t,r,e[r]);return t},l=(t,n)=>e(t,r(n)),c=(t,e,r)=>new Promise((n,o)=>{var i=t=>{try{s(r.next(t))}catch(e){o(e)}},a=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(i,a);s((r=r.apply(t,e)).next())});function d(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,p={exports:{}};var h=(u||(u=1,p.exports=function(){function t(e){return(t="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})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===n(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(n(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return i(t,e,n),a(t,e,n),function(t,e,n){var s=r(e),l=r(t);if("object"===s){if("object"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'object' type, but got '").concat(l,"'"));Object.keys(e).forEach(function(r){var s=t[r],l=e[r],c=n.slice();c.push(r),i(s,l,c),a(s,l,c),o(s,l,c)})}if("array"===s){if("array"!==l)throw new Error("[Type Error]: '".concat(n.join("."),"' require 'array' type, but got '").concat(l,"'"));t.forEach(function(r,s){var l=t[s],c=e[s]||e[0],d=n.slice();d.push(s),i(l,c,d),a(l,c,d),o(l,c,d)})}}(t,e,n),t}function i(t,e,n){if("string"===r(e)){var o=r(t);if("?"===e[0]&&(e=e.slice(1)+"|undefined"),!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return o===t}):e.toLowerCase().trim()===o))throw new Error("[Type Error]: '".concat(n.join("."),"' require '").concat(e,"' type, but got '").concat(o,"'"))}}function a(t,e,n){if("function"===r(e)){var o=e(t,r(t),n);if(!0!==o){var i=r(o);throw"string"===i?new Error(o):"error"===i?o:new Error("[Validator Error]: The scheme for '".concat(n.join("."),"' validator require return true, but got '").concat(o,"'"))}}}return o.kindOf=r,o}()),p.exports);const f=d(h),m="5.4.1";function g(t,e){let r=document.getElementById(t);r||(r=document.createElement("style"),r.id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.apLine truncated
|
||||
+345
-210
@@ -221,6 +221,44 @@ function requireOptionValidator() {
|
||||
var optionValidatorExports = requireOptionValidator();
|
||||
const validator = /* @__PURE__ */ getDefaultExportFromCjs(optionValidatorExports);
|
||||
const version$1 = "5.4.1";
|
||||
function setStyleText(id2, style) {
|
||||
let $style = document.getElementById(id2);
|
||||
if (!$style) {
|
||||
$style = document.createElement("style");
|
||||
$style.id = id2;
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.head.appendChild($style);
|
||||
});
|
||||
} else {
|
||||
(document.head || document.documentElement).appendChild($style);
|
||||
}
|
||||
}
|
||||
$style.textContent = style;
|
||||
}
|
||||
const customAgent = globalThis.CUSTOM_USER_AGENT;
|
||||
const userAgent = customAgent ?? (typeof navigator === "undefined" ? "" : navigator.userAgent);
|
||||
const isSafari = /^(?:(?!chrome|android).)*safari/i.test(userAgent);
|
||||
const isIOS = /iPad|iPhone|iPod/i.test(userAgent) && (typeof window === "undefined" || !window.MSStream);
|
||||
const isIOS13 = isIOS || userAgent.includes("Macintosh") && typeof navigator !== "undefined" && navigator.maxTouchPoints >= 1;
|
||||
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) || isIOS13;
|
||||
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
||||
function publishBrowserEntry(Artplayer2, style) {
|
||||
if (!isBrowser)
|
||||
return;
|
||||
window.Artplayer = Artplayer2;
|
||||
setStyleText("artplayer-style", style);
|
||||
setTimeout(() => {
|
||||
if (Artplayer2.LOG_VERSION) {
|
||||
console.log(
|
||||
`%c ArtPlayer %c ${Artplayer2.version} %c https://artplayer.org`,
|
||||
"color: #fff; background: #5f5f5f",
|
||||
"color: #fff; background: #4bc729",
|
||||
""
|
||||
);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
const config$1 = {
|
||||
properties: [
|
||||
"audioTracks",
|
||||
@@ -387,6 +425,16 @@ function isClosing(owner) {
|
||||
const state2 = stateOf$1(owner);
|
||||
return state2.destroying || state2.scope.closed;
|
||||
}
|
||||
function duringTemplateMount(owner, template, initialize) {
|
||||
const state2 = stateOf$1(owner);
|
||||
const previous = state2.mountingTemplate;
|
||||
state2.mountingTemplate = template;
|
||||
try {
|
||||
initialize();
|
||||
} finally {
|
||||
state2.mountingTemplate = previous;
|
||||
}
|
||||
}
|
||||
function ownContainer(owner, container, rollback) {
|
||||
const current2 = containers.get(container);
|
||||
if (current2 && current2 !== owner)
|
||||
@@ -420,7 +468,7 @@ function destroyInstance(owner, instances2, removeHtml, removeSource, failed = f
|
||||
if (removeSource && owner.template?.$video)
|
||||
attempt(() => owner.reset());
|
||||
attempt(() => state2.scope.dispose());
|
||||
attempt(() => owner.template?.destroy(removeHtml));
|
||||
attempt(() => (owner.template || state2.mountingTemplate)?.destroy(removeHtml));
|
||||
const index = instances2.indexOf(owner);
|
||||
if (index !== -1)
|
||||
instances2.splice(index, 1);
|
||||
@@ -490,12 +538,122 @@ function controlEvents(art, element) {
|
||||
proxy: (target, name, callback) => proxyEntry(art, element, target, name, callback)
|
||||
};
|
||||
}
|
||||
const userAgent = globalThis?.CUSTOM_USER_AGENT ?? (typeof navigator !== "undefined" ? navigator.userAgent : "");
|
||||
const isSafari = /^(?:(?!chrome|android).)*safari/i.test(userAgent);
|
||||
const isIOS = /iPad|iPhone|iPod/i.test(userAgent) && !window.MSStream;
|
||||
const isIOS13 = isIOS || userAgent.includes("Macintosh") && navigator.maxTouchPoints >= 1;
|
||||
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) || isIOS13;
|
||||
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
||||
function getComposedPath(event) {
|
||||
if (event.composedPath)
|
||||
return event.composedPath();
|
||||
const path = [];
|
||||
let node = event.target;
|
||||
while (node) {
|
||||
path.push(node);
|
||||
node = node.parentNode ?? null;
|
||||
}
|
||||
if (typeof window !== "undefined" && !path.includes(window))
|
||||
path.push(window);
|
||||
return path;
|
||||
}
|
||||
function includeFromEvent(event, target) {
|
||||
return getComposedPath(event).includes(target);
|
||||
}
|
||||
function supportsFlex() {
|
||||
const div = document.createElement("div");
|
||||
div.style.display = "flex";
|
||||
return div.style.display === "flex";
|
||||
}
|
||||
function getRect(el) {
|
||||
return el.getBoundingClientRect();
|
||||
}
|
||||
function isInViewport(el, offset = 0) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
||||
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
const vertInView = rect.top - offset <= windowHeight && rect.top + rect.height + offset >= 0;
|
||||
const horInView = rect.left - offset <= windowWidth + offset && rect.left + rect.width + offset >= 0;
|
||||
return vertInView && horInView;
|
||||
}
|
||||
function getSafeAreaInsets() {
|
||||
const div = document.createElement("div");
|
||||
div.style.cssText = "position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;";
|
||||
try {
|
||||
document.body.appendChild(div);
|
||||
const style = getComputedStyle(div);
|
||||
return {
|
||||
top: Number.parseFloat(style.top) || 0,
|
||||
right: Number.parseFloat(style.right) || 0,
|
||||
bottom: Number.parseFloat(style.bottom) || 0,
|
||||
left: Number.parseFloat(style.left) || 0
|
||||
};
|
||||
} finally {
|
||||
div.remove();
|
||||
}
|
||||
}
|
||||
function query(selector, parent = document) {
|
||||
return parent.querySelector(selector);
|
||||
}
|
||||
function queryAll(selector, parent = document) {
|
||||
return Array.from(parent.querySelectorAll(selector));
|
||||
}
|
||||
function addClass(target, className2) {
|
||||
return target.classList.add(className2);
|
||||
}
|
||||
function removeClass(target, className2) {
|
||||
return target.classList.remove(className2);
|
||||
}
|
||||
function hasClass(target, className2) {
|
||||
return target.classList.contains(className2);
|
||||
}
|
||||
function append(parent, child) {
|
||||
if (child instanceof Element) {
|
||||
parent.appendChild(child);
|
||||
} else {
|
||||
parent.insertAdjacentHTML("beforeend", String(child));
|
||||
}
|
||||
return parent.lastElementChild || parent.lastChild;
|
||||
}
|
||||
function remove(child) {
|
||||
return child.parentNode.removeChild(child);
|
||||
}
|
||||
function siblings(target) {
|
||||
return Array.from(target.parentElement.children).filter((item) => item !== target);
|
||||
}
|
||||
function inverseClass(target, className2) {
|
||||
siblings(target).forEach((item) => removeClass(item, className2));
|
||||
addClass(target, className2);
|
||||
}
|
||||
function replaceElement(newChild, oldChild) {
|
||||
oldChild.parentNode.replaceChild(newChild, oldChild);
|
||||
return newChild;
|
||||
}
|
||||
function createElement(tag) {
|
||||
return document.createElement(tag);
|
||||
}
|
||||
function tooltip(target, msg, pos = "top") {
|
||||
if (isMobile)
|
||||
return;
|
||||
target.setAttribute("aria-label", msg);
|
||||
addClass(target, "hint--rounded");
|
||||
addClass(target, `hint--${pos}`);
|
||||
}
|
||||
function getIcon(key = "", html2 = "") {
|
||||
const icon = createElement("i");
|
||||
addClass(icon, "art-icon");
|
||||
addClass(icon, `art-icon-${key}`);
|
||||
append(icon, html2);
|
||||
return icon;
|
||||
}
|
||||
function setStyle(element, key, value) {
|
||||
const style = element.style;
|
||||
style[key] = value;
|
||||
return element;
|
||||
}
|
||||
function setStyles(element, styles) {
|
||||
for (const key in styles)
|
||||
setStyle(element, key, styles[key]);
|
||||
return element;
|
||||
}
|
||||
function getStyle(element, key, numberType = true) {
|
||||
const value = window.getComputedStyle(element, null).getPropertyValue(key);
|
||||
return numberType ? Number.parseFloat(value) : value;
|
||||
}
|
||||
function requestImage(url, scale, owner) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = owner ? owner.child() : new ResourceScope();
|
||||
@@ -622,136 +780,6 @@ function loadImg(url, scale) {
|
||||
function loadThumbnailImage(url, scale, owner) {
|
||||
return requestImage(url, scale, owner);
|
||||
}
|
||||
function setStyleText(id2, style) {
|
||||
let $style = document.getElementById(id2);
|
||||
if (!$style) {
|
||||
$style = document.createElement("style");
|
||||
$style.id = id2;
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.head.appendChild($style);
|
||||
});
|
||||
} else {
|
||||
(document.head || document.documentElement).appendChild($style);
|
||||
}
|
||||
}
|
||||
$style.textContent = style;
|
||||
}
|
||||
function query(selector, parent = document) {
|
||||
return parent.querySelector(selector);
|
||||
}
|
||||
function queryAll(selector, parent = document) {
|
||||
return Array.from(parent.querySelectorAll(selector));
|
||||
}
|
||||
function addClass(target, className2) {
|
||||
return target.classList.add(className2);
|
||||
}
|
||||
function removeClass(target, className2) {
|
||||
return target.classList.remove(className2);
|
||||
}
|
||||
function hasClass(target, className2) {
|
||||
return target.classList.contains(className2);
|
||||
}
|
||||
function append(parent, child) {
|
||||
if (child instanceof Element) {
|
||||
parent.appendChild(child);
|
||||
} else {
|
||||
parent.insertAdjacentHTML("beforeend", String(child));
|
||||
}
|
||||
return parent.lastElementChild || parent.lastChild;
|
||||
}
|
||||
function remove(child) {
|
||||
return child.parentNode.removeChild(child);
|
||||
}
|
||||
function setStyle(element, key, value) {
|
||||
element.style[key] = value;
|
||||
return element;
|
||||
}
|
||||
function setStyles(element, styles) {
|
||||
for (const key in styles) {
|
||||
setStyle(element, key, styles[key]);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
function getStyle(element, key, numberType = true) {
|
||||
const value = window.getComputedStyle(element, null).getPropertyValue(key);
|
||||
return numberType ? Number.parseFloat(value) : value;
|
||||
}
|
||||
function siblings(target) {
|
||||
return Array.from(target.parentElement.children).filter((item) => item !== target);
|
||||
}
|
||||
function inverseClass(target, className2) {
|
||||
siblings(target).forEach((item) => removeClass(item, className2));
|
||||
addClass(target, className2);
|
||||
}
|
||||
function tooltip(target, msg, pos = "top") {
|
||||
if (isMobile)
|
||||
return;
|
||||
target.setAttribute("aria-label", msg);
|
||||
addClass(target, "hint--rounded");
|
||||
addClass(target, `hint--${pos}`);
|
||||
}
|
||||
function isInViewport(el, offset = 0) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
||||
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
const vertInView = rect.top - offset <= windowHeight && rect.top + rect.height + offset >= 0;
|
||||
const horInView = rect.left - offset <= windowWidth + offset && rect.left + rect.width + offset >= 0;
|
||||
return vertInView && horInView;
|
||||
}
|
||||
function includeFromEvent(event, target) {
|
||||
return getComposedPath(event).includes(target);
|
||||
}
|
||||
function replaceElement(newChild, oldChild) {
|
||||
oldChild.parentNode.replaceChild(newChild, oldChild);
|
||||
return newChild;
|
||||
}
|
||||
function createElement(tag) {
|
||||
return document.createElement(tag);
|
||||
}
|
||||
function getIcon(key = "", html2 = "") {
|
||||
const icon = createElement("i");
|
||||
addClass(icon, "art-icon");
|
||||
addClass(icon, `art-icon-${key}`);
|
||||
append(icon, html2);
|
||||
return icon;
|
||||
}
|
||||
function supportsFlex() {
|
||||
const div = document.createElement("div");
|
||||
div.style.display = "flex";
|
||||
return div.style.display === "flex";
|
||||
}
|
||||
function getRect(el) {
|
||||
return el.getBoundingClientRect();
|
||||
}
|
||||
function getComposedPath(event) {
|
||||
if (event.composedPath)
|
||||
return event.composedPath();
|
||||
const path = [];
|
||||
let node = event.target;
|
||||
while (node) {
|
||||
path.push(node);
|
||||
node = node.parentNode;
|
||||
}
|
||||
if (!path.includes(window) && window !== void 0) {
|
||||
path.push(window);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
function getSafeAreaInsets() {
|
||||
const div = document.createElement("div");
|
||||
div.style.cssText = "position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;";
|
||||
document.body.appendChild(div);
|
||||
const style = getComputedStyle(div);
|
||||
const insets = {
|
||||
top: Number.parseFloat(style.top) || 0,
|
||||
right: Number.parseFloat(style.right) || 0,
|
||||
bottom: Number.parseFloat(style.bottom) || 0,
|
||||
left: Number.parseFloat(style.left) || 0
|
||||
};
|
||||
div.remove();
|
||||
return insets;
|
||||
}
|
||||
class ArtPlayerError extends Error {
|
||||
constructor(message, context) {
|
||||
super(message);
|
||||
@@ -3444,7 +3472,12 @@ function resolveOption(input, defaults2) {
|
||||
merged.container = input.container;
|
||||
return validator(merged, scheme);
|
||||
}
|
||||
function resolveRuntimeOption(input, defaults2) {
|
||||
return resolveOption(input, defaults2);
|
||||
}
|
||||
function airplayMix(art) {
|
||||
if (isClosing(art))
|
||||
return;
|
||||
const {
|
||||
i18n,
|
||||
notice,
|
||||
@@ -3452,8 +3485,16 @@ function airplayMix(art) {
|
||||
template: { $video }
|
||||
} = art;
|
||||
let available = true;
|
||||
if (window.WebKitPlaybackTargetAvailabilityEvent && $video.webkitShowPlaybackTargetPicker) {
|
||||
const supported = window.WebKitPlaybackTargetAvailabilityEvent;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
const picker = supported && $video.webkitShowPlaybackTargetPicker;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (picker) {
|
||||
proxy($video, "webkitplaybacktargetavailabilitychanged", (event) => {
|
||||
if (isClosing(art))
|
||||
return;
|
||||
switch (event.availability) {
|
||||
case "available":
|
||||
available = true;
|
||||
@@ -3466,13 +3507,23 @@ function airplayMix(art) {
|
||||
} else {
|
||||
available = false;
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
def(art, "airplay", {
|
||||
value() {
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (available) {
|
||||
$video.webkitShowPlaybackTargetPicker();
|
||||
art.emit("airplay");
|
||||
const picker2 = $video.webkitShowPlaybackTargetPicker;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
Reflect.apply(picker2, $video, []);
|
||||
if (!isClosing(art))
|
||||
art.emit("airplay");
|
||||
} else {
|
||||
notice.show = i18n.get("AirPlay Not Available");
|
||||
const message = i18n.get("AirPlay Not Available");
|
||||
if (!isClosing(art))
|
||||
notice.show = message;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -3534,9 +3585,10 @@ function attrMix(art) {
|
||||
} = art;
|
||||
def(art, "attr", {
|
||||
value(key, value) {
|
||||
const target = $video;
|
||||
if (value === void 0)
|
||||
return $video[key];
|
||||
$video[key] = value;
|
||||
return target[key];
|
||||
target[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -4678,41 +4730,93 @@ function miniMix(art) {
|
||||
def(art, "mini", mini(art));
|
||||
}
|
||||
function optionInit(art) {
|
||||
if (isClosing(art))
|
||||
return;
|
||||
const {
|
||||
option,
|
||||
storage,
|
||||
template: { $video, $poster }
|
||||
} = art;
|
||||
for (const key in option.moreVideoAttr) {
|
||||
art.attr(key, option.moreVideoAttr[key]);
|
||||
if (isClosing(art))
|
||||
return;
|
||||
const value = option.moreVideoAttr[key];
|
||||
if (isClosing(art))
|
||||
return;
|
||||
art.attr(key, value);
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (option.muted) {
|
||||
art.muted = option.muted;
|
||||
const value = option.muted;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
art.muted = value;
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (option.volume) {
|
||||
$video.volume = clamp(option.volume, 0, 1);
|
||||
const value = clamp(option.volume, 0, 1);
|
||||
if (isClosing(art))
|
||||
return;
|
||||
$video.volume = value;
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
const volumeStorage = storage.get("volume");
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (typeof volumeStorage === "number") {
|
||||
$video.volume = clamp(volumeStorage, 0, 1);
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (option.poster) {
|
||||
setStyle($poster, "backgroundImage", `url(${option.poster})`);
|
||||
const value = `url(${option.poster})`;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
setStyle($poster, "backgroundImage", value);
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (option.autoplay) {
|
||||
$video.autoplay = option.autoplay;
|
||||
const value = option.autoplay;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
$video.autoplay = value;
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (option.playsInline) {
|
||||
if (isClosing(art))
|
||||
return;
|
||||
$video.playsInline = true;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
$video["webkit-playsinline"] = true;
|
||||
}
|
||||
if (isClosing(art))
|
||||
return;
|
||||
if (option.theme) {
|
||||
option.cssVar["--art-theme"] = option.theme;
|
||||
const styles = option.cssVar;
|
||||
const theme = option.theme;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
styles["--art-theme"] = theme;
|
||||
}
|
||||
for (const key in option.cssVar) {
|
||||
art.cssVar(key, option.cssVar[key]);
|
||||
if (isClosing(art))
|
||||
return;
|
||||
const value = option.cssVar[key];
|
||||
if (isClosing(art))
|
||||
return;
|
||||
art.cssVar(key, value);
|
||||
}
|
||||
art.url = option.url;
|
||||
if (isClosing(art))
|
||||
return;
|
||||
const url = option.url;
|
||||
if (!isClosing(art))
|
||||
art.url = url;
|
||||
}
|
||||
function pauseMix(art) {
|
||||
const {
|
||||
@@ -5614,43 +5718,52 @@ function volumeMix(art) {
|
||||
}
|
||||
});
|
||||
}
|
||||
const installers = [
|
||||
attrMix,
|
||||
playMix,
|
||||
pauseMix,
|
||||
toggleMix,
|
||||
seekMix,
|
||||
volumeMix,
|
||||
currentTimeMix,
|
||||
durationMix,
|
||||
switchMix,
|
||||
playbackRateMix,
|
||||
aspectRatioMix,
|
||||
screenshotMix,
|
||||
fullscreenMix,
|
||||
fullscreenWebMix,
|
||||
pipMix,
|
||||
loadedMix,
|
||||
playedMix,
|
||||
playingMix,
|
||||
autoSizeMix,
|
||||
rectMix,
|
||||
flipMix,
|
||||
miniMix,
|
||||
posterMix,
|
||||
autoHeightMix,
|
||||
cssVarMix,
|
||||
themeMix,
|
||||
typeMix,
|
||||
stateMix,
|
||||
subtitleOffsetMix,
|
||||
airplayMix,
|
||||
qualityMix,
|
||||
thumbnailsMix,
|
||||
eventInit,
|
||||
optionInit
|
||||
];
|
||||
class Player {
|
||||
constructor(art) {
|
||||
if (isClosing(art))
|
||||
return;
|
||||
urlMix(art);
|
||||
attrMix(art);
|
||||
playMix(art);
|
||||
pauseMix(art);
|
||||
toggleMix(art);
|
||||
seekMix(art);
|
||||
volumeMix(art);
|
||||
currentTimeMix(art);
|
||||
durationMix(art);
|
||||
switchMix(art);
|
||||
playbackRateMix(art);
|
||||
aspectRatioMix(art);
|
||||
screenshotMix(art);
|
||||
fullscreenMix(art);
|
||||
fullscreenWebMix(art);
|
||||
pipMix(art);
|
||||
loadedMix(art);
|
||||
playedMix(art);
|
||||
playingMix(art);
|
||||
autoSizeMix(art);
|
||||
rectMix(art);
|
||||
flipMix(art);
|
||||
miniMix(art);
|
||||
posterMix(art);
|
||||
autoHeightMix(art);
|
||||
cssVarMix(art);
|
||||
themeMix(art);
|
||||
typeMix(art);
|
||||
stateMix(art);
|
||||
subtitleOffsetMix(art);
|
||||
airplayMix(art);
|
||||
qualityMix(art);
|
||||
thumbnailsMix(art);
|
||||
eventInit(art);
|
||||
optionInit(art);
|
||||
for (const install of installers) {
|
||||
if (isClosing(art))
|
||||
return;
|
||||
install(art);
|
||||
}
|
||||
}
|
||||
}
|
||||
const owners$2 = /* @__PURE__ */ new WeakMap();
|
||||
@@ -6136,9 +6249,8 @@ function installBuiltins(registry, option) {
|
||||
registry.add(lock);
|
||||
if (!isClosing(registry.art) && option.autoPlayback && !option.isLive)
|
||||
registry.add(autoPlayback);
|
||||
if (!isClosing(registry.art) && option.autoOrientation && isMobile) {
|
||||
if (!isClosing(registry.art) && option.autoOrientation && isMobile)
|
||||
registry.add(autoOrientation);
|
||||
}
|
||||
if (!isClosing(registry.art) && option.fastForward && isMobile && !option.isLive)
|
||||
registry.add(fastForward);
|
||||
}
|
||||
@@ -7112,7 +7224,7 @@ function createSettingHeader(setting2, item) {
|
||||
setStyle($item, "height", `${SETTING_ITEM_HEIGHT}px`);
|
||||
addClass($item, "art-setting-item");
|
||||
addClass($item, "art-setting-item-back");
|
||||
const $left = append($item, '<div class="art-setting-item-left"></div>');
|
||||
const $left = appendElement($item, '<div class="art-setting-item-left"></div>');
|
||||
const $icon = document.createElement("div");
|
||||
addClass($icon, "art-setting-item-left-icon");
|
||||
append($icon, arrowLeft2);
|
||||
@@ -7153,8 +7265,8 @@ function createSettingItem(setting2, item, isUpdate = false) {
|
||||
$item.dataset.value = String(item.value || "");
|
||||
if (!current2())
|
||||
return;
|
||||
const $left = append($item, '<div class="art-setting-item-left"></div>');
|
||||
const $right = append($item, '<div class="art-setting-item-right"></div>');
|
||||
const $left = appendElement($item, '<div class="art-setting-item-left"></div>');
|
||||
const $right = appendElement($item, '<div class="art-setting-item-right"></div>');
|
||||
const $icon = document.createElement("div");
|
||||
addClass($icon, "art-setting-item-left-icon");
|
||||
switch (type) {
|
||||
@@ -7204,8 +7316,8 @@ function createSettingItem(setting2, item, isUpdate = false) {
|
||||
case "switch": {
|
||||
const $switch = document.createElement("div");
|
||||
addClass($switch, "art-setting-item-right-icon");
|
||||
const $switchOn = append($switch, icons.switchOn);
|
||||
const $switchOff = append($switch, icons.switchOff);
|
||||
const $switchOn = appendElement($switch, icons.switchOn);
|
||||
const $switchOff = appendElement($switch, icons.switchOff);
|
||||
const initialSwitch = item.switch;
|
||||
if (!current2())
|
||||
return;
|
||||
@@ -7992,8 +8104,10 @@ class Template {
|
||||
);
|
||||
this.query = this.query.bind(this);
|
||||
ownContainer(art, this.$container, captureTemplate(this.$container));
|
||||
this.$container.dataset.artId = String(art.id);
|
||||
this.init();
|
||||
duringTemplateMount(art, this, () => {
|
||||
this.$container.dataset.artId = String(art.id);
|
||||
this.init();
|
||||
});
|
||||
}
|
||||
static get html() {
|
||||
return html;
|
||||
@@ -8009,6 +8123,8 @@ class Template {
|
||||
bindNodes(this);
|
||||
if (option.proxy) {
|
||||
const video = option.proxy.call(this.art, this.art);
|
||||
if (isClosing(this.art))
|
||||
return;
|
||||
assertProxy(video);
|
||||
replaceElement(video, this.$video);
|
||||
video.className = "art-video";
|
||||
@@ -8097,7 +8213,7 @@ class Artplayer extends Emitter {
|
||||
throw new Error("Artplayer can only be used in the browser environment");
|
||||
}
|
||||
this.id = ++id;
|
||||
this.option = resolveOption(option, Artplayer.option);
|
||||
this.option = resolveRuntimeOption(option, Artplayer.option);
|
||||
this.isLock = false;
|
||||
this.isReady = false;
|
||||
this.isFocus = false;
|
||||
@@ -8107,21 +8223,53 @@ class Artplayer extends Emitter {
|
||||
beginLifecycle(this);
|
||||
try {
|
||||
this.template = new Template(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.events = new Events(this);
|
||||
this.storage = new Storage(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.storage = new Storage();
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.icons = new Icons(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.i18n = new I18n(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.notice = new Notice(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.player = new Player(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.layers = new Layer(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.controls = new Control(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.contextmenu = new Contextmenu(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.subtitle = new Subtitle(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.info = new Info(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.loading = new Loading(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.hotkey = new Hotkey(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.mask = new Mask(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.setting = new Setting(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
this.plugins = new Plugins(this);
|
||||
if (getScope(this).closed)
|
||||
return;
|
||||
@@ -8227,20 +8375,7 @@ Artplayer.FULLSCREEN_WEB_IN_BODY = true;
|
||||
Artplayer.LOG_VERSION = true;
|
||||
Artplayer.USE_RAF = false;
|
||||
Artplayer.REMOVE_SRC_WHEN_DESTROY = true;
|
||||
if (isBrowser) {
|
||||
window.Artplayer = Artplayer;
|
||||
setStyleText("artplayer-style", css);
|
||||
setTimeout(() => {
|
||||
if (Artplayer.LOG_VERSION) {
|
||||
console.log(
|
||||
`%c ArtPlayer %c ${Artplayer.version} %c https://artplayer.org`,
|
||||
"color: #fff; background: #5f5f5f",
|
||||
"color: #fff; background: #4bc729",
|
||||
""
|
||||
);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
publishBrowserEntry(Artplayer, css);
|
||||
export {
|
||||
Artplayer as default
|
||||
};
|
||||
Reference in new issue
Block a user