aliyun-aliplayer 2.33.0 → 2.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! aliyun-aliplayer - v2.33.
|
|
2
|
-
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Aliplayer=t()}(function(){return function r(o,i,s){function u(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return u(o[e][1][t]||t)},n,n.exports,r,o,i,s)}return i[e].exports}for(var c="function"==typeof require&&require,t=0;t<s.length;t++)u(s[t]);return u}({1:[function(D,n,r){!function(Y,B){!function(){var t,e;t=this,e=function(){function c(t){return"function"==typeof t}var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},r=0,e=void 0,o=void 0,s=function(t,e){l[r]=t,l[r+1]=e,2===(r+=2)&&(o?o(h):U())};var t="undefined"!=typeof window?window:void 0,i=t||{},i=i.MutationObserver||i.WebKitMutationObserver,u="undefined"==typeof self&&void 0!==Y&&"[object process]"==={}.toString.call(Y),a="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function f(){var t=setTimeout;return function(){return t(h,1)}}var l=new Array(1e3);function h(){for(var t=0;t<r;t+=2)(0,l[t])(l[t+1]),l[t]=void 0,l[t+1]=void 0;r=0}function p(){try{var t=Function("return this")().require("vertx");return void 0!==(e=t.runOnLoop||t.runOnContext)?function(){e(h)}:f()}catch(t){return f()}}var d,v,y,U=void 0;function m(t,e){var n,r=this,o=new this.constructor(_),i=(void 0===o[g]&&M(o),r._state);return i?(n=arguments[i-1],s(function(){return P(i,o,n,r._result)})):S(r,o,t,e),o}function w(t){var e;return t&&"object"==typeof t&&t.constructor===this?t:(E(e=new this(_),t),e)}var U=u?function(){return Y.nextTick(h)}:i?(v=0,u=new i(h),y=document.createTextNode(""),u.observe(y,{characterData:!0}),function(){y.data=v=++v%2}):a?((d=new MessageChannel).port1.onmessage=h,function(){return d.port2.postMessage(0)}):(void 0===t&&"function"==typeof D?p:f)(),g=Math.random().toString(36).substring(2);function _(){}var b=void 0,T=1,O=2;function G(t,r,o){s(function(e){var n=!1,t=((t,e,n,r)=>{try{t.call(e,n,r)}catch(t){return t}})(o,r,function(t){n||(n=!0,(r!==t?E:x)(e,t))},function(t){n||(n=!0,A(e,t))},e._label);!n&&t&&(n=!0,A(e,t))},t)}function j(t,e,n){var r,o;e.constructor===t.constructor&&n===m&&e.constructor.resolve===w?(r=t,(o=e)._state===T?x(r,o._result):o._state===O?A(r,o._result):S(o,void 0,function(t){return E(r,t)},function(t){return A(r,t)})):void 0!==n&&c(n)?G(t,e,n):x(t,e)}function E(e,t){if(e===t)A(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof t,null===t||"object"!=n&&"function"!=n)x(e,t);else{n=void 0;try{n=t.then}catch(t){return void A(e,t)}j(e,t,n)}var n}function N(t){t._onerror&&t._onerror(t._result),k(t)}function x(t,e){t._state===b&&(t._result=e,t._state=T,0!==t._subscribers.length)&&s(k,t)}function A(t,e){t._state===b&&(t._state=O,t._result=e,s(N,t))}function S(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=n,o[i+O]=r,0===i&&t._state&&s(k,t)}function k(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function P(t,e,n,r){var o=c(n),i=void 0,s=void 0,u=!0;if(o){try{i=n(r)}catch(t){u=!1,s=t}if(e===i)return void A(e,new TypeError("A promises callback cannot return that same promise."))}else i=r;e._state===b&&(o&&u?E(e,i):!1===u?A(e,s):t===T?x(e,i):t===O&&A(e,i))}var L=0;function M(t){t[g]=L++,t._state=void 0,t._result=void 0,t._subscribers=[]}C.prototype._enumerate=function(t){for(var e=0;this._state===b&&e<t.length;e++)this._eachEntry(t[e],e)},C.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===w){var o,i=void 0,s=void 0,u=!1;try{i=e.then}catch(t){u=!0,s=t}i===m&&e._state!==b?this._settledAt(e._state,t,e._result):"function"!=typeof i?(this._remaining--,this._result[t]=e):n===q?(o=new n(_),u?A(o,s):j(o,e,i),this._willSettleAt(o,t)):this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},C.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===b&&(this._remaining--,t===O?A(r,n):this._result[e]=n),0===this._remaining&&x(r,this._result)},C.prototype._willSettleAt=function(t,e){var n=this;S(t,void 0,function(t){return n._settledAt(T,e,t)},function(t){return n._settledAt(O,e,t)})};var W=C;function C(t,e){this._instanceConstructor=t,this.promise=new t(_),this.promise[g]||M(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0!==this.length&&(this.length=this.length||0,this._enumerate(e),0!==this._remaining)||x(this.promise,this._result)):A(this.promise,new Error("Array Methods must be provided an Array"))}F.prototype.catch=function(t){return this.then(null,t)},F.prototype.finally=function(e){var n=this.constructor;return c(e)?this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})}):this.then(e,e)};var q=F;function F(t){if(this[g]=L++,this._result=this._state=void 0,this._subscribers=[],_!==t){if("function"!=typeof t)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof F))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");var e=this;try{t(function(t){E(e,t)},function(t){A(e,t)})}catch(t){A(e,t)}}}return q.prototype.then=m,q.all=function(t){return new W(this,t).promise},q.race=function(o){var i=this;return n(o)?new i(function(t,e){for(var n=o.length,r=0;r<n;r++)i.resolve(o[r]).then(t,e)}):new i(function(t,e){return e(new TypeError("You must pass an array to race."))})},q.resolve=w,q.reject=function(t){var e=new this(_);return A(e,t),e},q._setScheduler=function(t){o=t},q._setAsap=function(t){s=t},q._asap=s,q.polyfill=function(){var t=void 0;if(void 0!==B)t=B;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=q},q.Promise=q},"object"==typeof r&&void 0!==n?n.exports=e():t.ES6Promise=e()}.call(this)}.call(this,D("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(t,e,n){var r,o,e=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(t){o=s}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return(r=setTimeout)(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}var c,a=[],f=!1,l=-1;function h(){f&&c&&(f=!1,c.length?a=c.concat(a):l=-1,a.length)&&p()}function p(){if(!f){for(var t=u(h),e=(f=!0,a.length);e;){for(c=a,a=[];++l<e;)c&&c[l].run();l=-1,e=a.length}c=null,f=!1,!function(e){if(o===clearTimeout)return clearTimeout(e);if((o===s||!o)&&clearTimeout)return(o=clearTimeout)(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function v(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new d(t,e)),1!==a.length||f||u(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=v,e.addListener=v,e.once=v,e.off=v,e.removeListener=v,e.removeAllListeners=v,e.emit=v,e.prependListener=v,e.prependOnceListener=v,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}],3:[function(t,e,n){function c(){var d,t="function"==typeof Symbol?Symbol:{},e=t.iterator||"@@iterator",n=t.toStringTag||"@@toStringTag";function r(t,e,n,r){var o,i,s,u,c,a,f,l,h,e=e&&e.prototype instanceof y?e:y,e=Object.create(e.prototype);return w(e,"_invoke",(o=t,i=n,f=r||[],l=!1,h={p:a=0,n:0,v:d,a:p,f:p.bind(d,4),d:function(t,e){return s=t,u=0,c=d,h.n=e,v}},function(t,e,n){if(1<a)throw TypeError("Generator is already running");for(l&&1===e&&p(e,n),u=e,c=n;(m=u<2?d:c)||!l;){s||(u?u<3?(1<u&&(h.n=-1),p(u,c)):h.n=c:h.v=c);try{if(a=2,s){if(m=s[t=u?t:"next"]){if(!(m=m.call(s,c)))throw TypeError("iterator result is not an object");if(!m.done)return m;c=m.value,u<2&&(u=0)}else 1===u&&(m=s.return)&&m.call(s),u<2&&(c=TypeError("The iterator does not provide a '"+t+"' method"),u=1);s=d}else if((m=(l=h.n<0)?c:o.call(i,h))!==v)break}catch(t){s=d,u=1,c=t}finally{a=1}}return{value:m,done:l}}),!0),e;function p(t,e){for(u=t,c=e,m=0;!l&&a&&!n&&m<f.length;m++){var n,r=f[m],o=h.p,i=r[2];3<t?(n=i===e)&&(c=r[(u=r[4])?5:u=3],r[4]=r[5]=d):r[0]<=o&&((n=t<2&&o<r[1])?(u=0,h.v=e,h.n=r[1]):o<i&&(n=t<3||r[0]>e||i<e)&&(r[4]=t,r[5]=e,h.n=i,u=0))}if(n||1<t)return v;throw l=!0,e}}var v={};function y(){}function o(){}function i(){}var m=Object.getPrototypeOf,t=[][e]?m(m([][e]())):(w(m={},e,function(){return this}),m),s=i.prototype=y.prototype=Object.create(t);function u(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,i):(t.__proto__=i,w(t,n,"GeneratorFunction")),t.prototype=Object.create(s),t}return w(s,"constructor",o.prototype=i),w(i,"constructor",o),w(i,n,o.displayName="GeneratorFunction"),w(s),w(s,n,"Generator"),w(s,e,function(){return this}),w(s,"toString",function(){return"[object Generator]"}),(c=function(){return{w:r,m:u}})()}function w(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(w=function(t,e,n,r){function o(e,n){w(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))})(t,e,n,r)}function a(t,e,n,r,o,i,s){try{var u=t[i](s),c=u.value}catch(t){return n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function f(u){return function(){var t=this,s=arguments;return new Promise(function(e,n){var r=u.apply(t,s);function o(t){a(r,e,n,o,i,"next",t)}function i(t){a(r,e,n,o,i,"throw",t)}o(void 0)})}}var l="undefined"==typeof Promise?t("es6-promise").Promise:Promise,h="__aliplayerMessage__",s="setup",u="setupAck",p="dispose",d="encSegment",v="decSegment",y="abortSegment",r=0,m=1,g="fragment",_="playlist",o="other",i="unknown",b=null,T={},O={},j=r;function E(){b=null,Object.keys(T).forEach(function(t){T[t].controller.abort(),T[t].reject("Fetch aborted.")}),T={},O={},j=r}function x(t,e,n){var r="";try{r=/[0-9]+\.ts/.exec(e.url)[0]}catch(t){}console.log(("send"===n?"[SW -> Main]":"[Main -> SW]")+"["+t+"]",r,e)}self.addEventListener("install",function(t){self.skipWaiting()}),self.addEventListener("activate",(()=>{var e=f(c().m(function t(e){return c().w(function(t){for(;;)switch(t.n){case 0:e.waitUntil(clients.claim());case 1:return t.a(2)}},t)}));return function(t){return e.apply(this,arguments)}})()),self.addEventListener("fetch",function(t){if("navigate"===t.request.mode)E();else if(j!==r){var e,s=t.request.url,u=-1===(e=s).indexOf("_s=enc")?o:-1<e.indexOf(".ts")?g:-1<e.indexOf(".m3u8")?_:i;if(u!==o){if(u===i)return console.warn("Unknown request type",s);try{/[0-9]+\.ts/.exec(s)[0]}catch(t){}t.respondWith(f(c().m(function t(){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,new l((()=>{var n=f(c().m(function t(n,e){var o,i;return c().w(function(t){for(;;)switch(t.n){case 0:t.n=1;var r=s;return new l((()=>{var e=f(c().m(function t(e){var n;return c().w(function(t){for(;;)switch(t.n){case 0:if(0<Object.keys(T).length&&!T[r])return b||console.error("no player client!"),t.n=1,clients.get(b);t.n=2;break;case 1:n=t.v,Object.keys(T).forEach((()=>{var e=f(c().m(function t(e){return c().w(function(t){for(;;)switch(t.n){case 0:T[e].controller.abort(),T[e].reject(),n.postMessage({scope:h,name:y,payload:{url:e}}),x(y,{url:e},"send");case 1:return t.a(2)}},t)}));return function(t){return e.apply(this,arguments)}})());case 2:e();case 3:return t.a(2)}},t)}));return function(t){return e.apply(this,arguments)}})());case 1:o=new AbortController,u===g&&(T[s]={resolve:n,reject:e,controller:o}),performance.now(),fetch(s.replace("_s=enc",""),{signal:o.signal}).then(function(t){if(i=new Headers(t.headers),T[s])T[s].headers=i;else if(-1<s.indexOf(".ts"))return void console.warn("fragment request is missed",s);if(200===t.status)return u===_?t.text():t.arrayBuffer();n(t)}).then(function(e){var t;e&&(u===_?(O[s]=e,t=((t,e)=>{var r;if(e=e.replace(/#EXT-X-KEY:.*\n?/g,""),t=t.match(/^(.*)\/[^\/]*$/))return r=t[1],e=e.replace(/(#EXTINF:[^\n]+\n)([^\n]+)/g,function(t,e,n){return""+e+r+"/"+n+(-1<n.indexOf("?")?"&":"?")+"_s=enc"});console.warn("no match base url found.")})(s,e),i.set("Content-Length",new Blob([t]).size),n(new Response(t,{status:200,headers:i}))):(b||console.error("no player client!"),clients.get(b).then(function(t){t.postMessage({scope:h,name:d,payload:{buffer:e,url:s,playlistUrl:(t=>{var e,n=(t=>{var e;try{e=/\/([^/?]+)(\?|$)/.exec(t)[1]}catch(t){}return e})(t);return n||console.warn("no fragUrlBase"),Object.keys(O).some(function(t){return-1<O[t].indexOf(n)&&(e=t,!0)}),e})(s)}},[e]),x(d,{url:s},"send")})))}).catch(function(t){console.log("fetch error from remote",t),e(t),delete T[s]});case 2:return t.a(2)}},t)}));return function(t,e){return n.apply(this,arguments)}})()))},t)}))())}}}),self.addEventListener("message",function(t){var e=t.data;if((i=e)&&i.scope===h){var n,r,o,i=e.name;switch(x(i,e.payload),i){case s:b=t.source.id,j=m,clients.get(b).then(function(t){t.postMessage({scope:h,name:u,payload:{version:"2.33.0"}})});break;case p:E();break;case v:e.payload&&(n=e.payload,r=T[n.url])&&(delete T[n.url],(o=r.headers).set("Content-Length",n.buffer.byteLength),r.resolve(new Response(n.buffer,{status:200,headers:o})),x(v,n,"send"))}}})},{"es6-promise":1}]},{},[3])(3)});
|
|
1
|
+
/*! aliyun-aliplayer - v2.33.1 - 2025-08-18 14.48.44 */
|
|
2
|
+
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Aliplayer=t()}(function(){return function r(o,i,s){function u(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return u(o[e][1][t]||t)},n,n.exports,r,o,i,s)}return i[e].exports}for(var c="function"==typeof require&&require,t=0;t<s.length;t++)u(s[t]);return u}({1:[function(D,n,r){!function(Y,B){!function(){var t,e;t=this,e=function(){function c(t){return"function"==typeof t}var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},r=0,e=void 0,o=void 0,s=function(t,e){l[r]=t,l[r+1]=e,2===(r+=2)&&(o?o(h):U())};var t="undefined"!=typeof window?window:void 0,i=t||{},i=i.MutationObserver||i.WebKitMutationObserver,u="undefined"==typeof self&&void 0!==Y&&"[object process]"==={}.toString.call(Y),a="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function f(){var t=setTimeout;return function(){return t(h,1)}}var l=new Array(1e3);function h(){for(var t=0;t<r;t+=2)(0,l[t])(l[t+1]),l[t]=void 0,l[t+1]=void 0;r=0}function p(){try{var t=Function("return this")().require("vertx");return void 0!==(e=t.runOnLoop||t.runOnContext)?function(){e(h)}:f()}catch(t){return f()}}var d,v,y,U=void 0;function m(t,e){var n,r=this,o=new this.constructor(_),i=(void 0===o[g]&&M(o),r._state);return i?(n=arguments[i-1],s(function(){return P(i,o,n,r._result)})):S(r,o,t,e),o}function w(t){var e;return t&&"object"==typeof t&&t.constructor===this?t:(E(e=new this(_),t),e)}var U=u?function(){return Y.nextTick(h)}:i?(v=0,u=new i(h),y=document.createTextNode(""),u.observe(y,{characterData:!0}),function(){y.data=v=++v%2}):a?((d=new MessageChannel).port1.onmessage=h,function(){return d.port2.postMessage(0)}):(void 0===t&&"function"==typeof D?p:f)(),g=Math.random().toString(36).substring(2);function _(){}var b=void 0,T=1,O=2;function G(t,r,o){s(function(e){var n=!1,t=((t,e,n,r)=>{try{t.call(e,n,r)}catch(t){return t}})(o,r,function(t){n||(n=!0,(r!==t?E:x)(e,t))},function(t){n||(n=!0,A(e,t))},e._label);!n&&t&&(n=!0,A(e,t))},t)}function j(t,e,n){var r,o;e.constructor===t.constructor&&n===m&&e.constructor.resolve===w?(r=t,(o=e)._state===T?x(r,o._result):o._state===O?A(r,o._result):S(o,void 0,function(t){return E(r,t)},function(t){return A(r,t)})):void 0!==n&&c(n)?G(t,e,n):x(t,e)}function E(e,t){if(e===t)A(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof t,null===t||"object"!=n&&"function"!=n)x(e,t);else{n=void 0;try{n=t.then}catch(t){return void A(e,t)}j(e,t,n)}var n}function N(t){t._onerror&&t._onerror(t._result),k(t)}function x(t,e){t._state===b&&(t._result=e,t._state=T,0!==t._subscribers.length)&&s(k,t)}function A(t,e){t._state===b&&(t._state=O,t._result=e,s(N,t))}function S(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=n,o[i+O]=r,0===i&&t._state&&s(k,t)}function k(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function P(t,e,n,r){var o=c(n),i=void 0,s=void 0,u=!0;if(o){try{i=n(r)}catch(t){u=!1,s=t}if(e===i)return void A(e,new TypeError("A promises callback cannot return that same promise."))}else i=r;e._state===b&&(o&&u?E(e,i):!1===u?A(e,s):t===T?x(e,i):t===O&&A(e,i))}var L=0;function M(t){t[g]=L++,t._state=void 0,t._result=void 0,t._subscribers=[]}C.prototype._enumerate=function(t){for(var e=0;this._state===b&&e<t.length;e++)this._eachEntry(t[e],e)},C.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===w){var o,i=void 0,s=void 0,u=!1;try{i=e.then}catch(t){u=!0,s=t}i===m&&e._state!==b?this._settledAt(e._state,t,e._result):"function"!=typeof i?(this._remaining--,this._result[t]=e):n===q?(o=new n(_),u?A(o,s):j(o,e,i),this._willSettleAt(o,t)):this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},C.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===b&&(this._remaining--,t===O?A(r,n):this._result[e]=n),0===this._remaining&&x(r,this._result)},C.prototype._willSettleAt=function(t,e){var n=this;S(t,void 0,function(t){return n._settledAt(T,e,t)},function(t){return n._settledAt(O,e,t)})};var W=C;function C(t,e){this._instanceConstructor=t,this.promise=new t(_),this.promise[g]||M(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0!==this.length&&(this.length=this.length||0,this._enumerate(e),0!==this._remaining)||x(this.promise,this._result)):A(this.promise,new Error("Array Methods must be provided an Array"))}F.prototype.catch=function(t){return this.then(null,t)},F.prototype.finally=function(e){var n=this.constructor;return c(e)?this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})}):this.then(e,e)};var q=F;function F(t){if(this[g]=L++,this._result=this._state=void 0,this._subscribers=[],_!==t){if("function"!=typeof t)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof F))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");var e=this;try{t(function(t){E(e,t)},function(t){A(e,t)})}catch(t){A(e,t)}}}return q.prototype.then=m,q.all=function(t){return new W(this,t).promise},q.race=function(o){var i=this;return n(o)?new i(function(t,e){for(var n=o.length,r=0;r<n;r++)i.resolve(o[r]).then(t,e)}):new i(function(t,e){return e(new TypeError("You must pass an array to race."))})},q.resolve=w,q.reject=function(t){var e=new this(_);return A(e,t),e},q._setScheduler=function(t){o=t},q._setAsap=function(t){s=t},q._asap=s,q.polyfill=function(){var t=void 0;if(void 0!==B)t=B;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=q},q.Promise=q},"object"==typeof r&&void 0!==n?n.exports=e():t.ES6Promise=e()}.call(this)}.call(this,D("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(t,e,n){var r,o,e=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(t){o=s}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return(r=setTimeout)(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}var c,a=[],f=!1,l=-1;function h(){f&&c&&(f=!1,c.length?a=c.concat(a):l=-1,a.length)&&p()}function p(){if(!f){for(var t=u(h),e=(f=!0,a.length);e;){for(c=a,a=[];++l<e;)c&&c[l].run();l=-1,e=a.length}c=null,f=!1,!function(e){if(o===clearTimeout)return clearTimeout(e);if((o===s||!o)&&clearTimeout)return(o=clearTimeout)(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function v(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new d(t,e)),1!==a.length||f||u(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=v,e.addListener=v,e.once=v,e.off=v,e.removeListener=v,e.removeAllListeners=v,e.emit=v,e.prependListener=v,e.prependOnceListener=v,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}],3:[function(t,e,n){function c(){var d,t="function"==typeof Symbol?Symbol:{},e=t.iterator||"@@iterator",n=t.toStringTag||"@@toStringTag";function r(t,e,n,r){var o,i,s,u,c,a,f,l,h,e=e&&e.prototype instanceof y?e:y,e=Object.create(e.prototype);return w(e,"_invoke",(o=t,i=n,f=r||[],l=!1,h={p:a=0,n:0,v:d,a:p,f:p.bind(d,4),d:function(t,e){return s=t,u=0,c=d,h.n=e,v}},function(t,e,n){if(1<a)throw TypeError("Generator is already running");for(l&&1===e&&p(e,n),u=e,c=n;(m=u<2?d:c)||!l;){s||(u?u<3?(1<u&&(h.n=-1),p(u,c)):h.n=c:h.v=c);try{if(a=2,s){if(m=s[t=u?t:"next"]){if(!(m=m.call(s,c)))throw TypeError("iterator result is not an object");if(!m.done)return m;c=m.value,u<2&&(u=0)}else 1===u&&(m=s.return)&&m.call(s),u<2&&(c=TypeError("The iterator does not provide a '"+t+"' method"),u=1);s=d}else if((m=(l=h.n<0)?c:o.call(i,h))!==v)break}catch(t){s=d,u=1,c=t}finally{a=1}}return{value:m,done:l}}),!0),e;function p(t,e){for(u=t,c=e,m=0;!l&&a&&!n&&m<f.length;m++){var n,r=f[m],o=h.p,i=r[2];3<t?(n=i===e)&&(c=r[(u=r[4])?5:u=3],r[4]=r[5]=d):r[0]<=o&&((n=t<2&&o<r[1])?(u=0,h.v=e,h.n=r[1]):o<i&&(n=t<3||r[0]>e||i<e)&&(r[4]=t,r[5]=e,h.n=i,u=0))}if(n||1<t)return v;throw l=!0,e}}var v={};function y(){}function o(){}function i(){}var m=Object.getPrototypeOf,t=[][e]?m(m([][e]())):(w(m={},e,function(){return this}),m),s=i.prototype=y.prototype=Object.create(t);function u(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,i):(t.__proto__=i,w(t,n,"GeneratorFunction")),t.prototype=Object.create(s),t}return w(s,"constructor",o.prototype=i),w(i,"constructor",o),w(i,n,o.displayName="GeneratorFunction"),w(s),w(s,n,"Generator"),w(s,e,function(){return this}),w(s,"toString",function(){return"[object Generator]"}),(c=function(){return{w:r,m:u}})()}function w(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(w=function(t,e,n,r){function o(e,n){w(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))})(t,e,n,r)}function a(t,e,n,r,o,i,s){try{var u=t[i](s),c=u.value}catch(t){return n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function f(u){return function(){var t=this,s=arguments;return new Promise(function(e,n){var r=u.apply(t,s);function o(t){a(r,e,n,o,i,"next",t)}function i(t){a(r,e,n,o,i,"throw",t)}o(void 0)})}}var l="undefined"==typeof Promise?t("es6-promise").Promise:Promise,h="__aliplayerMessage__",s="setup",u="setupAck",p="dispose",d="encSegment",v="decSegment",y="abortSegment",r=0,m=1,g="fragment",_="playlist",o="other",i="unknown",b=null,T={},O={},j=r;function E(){b=null,Object.keys(T).forEach(function(t){T[t].controller.abort(),T[t].reject("Fetch aborted.")}),T={},O={},j=r}function x(t,e,n){var r="";try{r=/[0-9]+\.ts/.exec(e.url)[0]}catch(t){}console.log(("send"===n?"[SW -> Main]":"[Main -> SW]")+"["+t+"]",r,e)}self.addEventListener("install",function(t){self.skipWaiting()}),self.addEventListener("activate",(()=>{var e=f(c().m(function t(e){return c().w(function(t){for(;;)switch(t.n){case 0:e.waitUntil(clients.claim());case 1:return t.a(2)}},t)}));return function(t){return e.apply(this,arguments)}})()),self.addEventListener("fetch",function(t){if("navigate"===t.request.mode)E();else if(j!==r){var e,s=t.request.url,u=-1===(e=s).indexOf("_s=enc")?o:-1<e.indexOf(".ts")?g:-1<e.indexOf(".m3u8")?_:i;if(u!==o){if(u===i)return console.warn("Unknown request type",s);try{/[0-9]+\.ts/.exec(s)[0]}catch(t){}t.respondWith(f(c().m(function t(){return c().w(function(t){for(;;)if(0===t.n)return t.a(2,new l((()=>{var n=f(c().m(function t(n,e){var o,i;return c().w(function(t){for(;;)switch(t.n){case 0:t.n=1;var r=s;return new l((()=>{var e=f(c().m(function t(e){var n;return c().w(function(t){for(;;)switch(t.n){case 0:if(0<Object.keys(T).length&&!T[r])return b||console.error("no player client!"),t.n=1,clients.get(b);t.n=2;break;case 1:n=t.v,Object.keys(T).forEach((()=>{var e=f(c().m(function t(e){return c().w(function(t){for(;;)switch(t.n){case 0:T[e].controller.abort(),T[e].reject(),n.postMessage({scope:h,name:y,payload:{url:e}}),x(y,{url:e},"send");case 1:return t.a(2)}},t)}));return function(t){return e.apply(this,arguments)}})());case 2:e();case 3:return t.a(2)}},t)}));return function(t){return e.apply(this,arguments)}})());case 1:o=new AbortController,u===g&&(T[s]={resolve:n,reject:e,controller:o}),performance.now(),fetch(s.replace("_s=enc",""),{signal:o.signal}).then(function(t){if(i=new Headers(t.headers),T[s])T[s].headers=i;else if(-1<s.indexOf(".ts"))return void console.warn("fragment request is missed",s);if(200===t.status)return u===_?t.text():t.arrayBuffer();n(t)}).then(function(e){var t;e&&(u===_?(O[s]=e,t=((t,e)=>{var r;if(e=e.replace(/#EXT-X-KEY:.*\n?/g,""),t=t.match(/^(.*)\/[^\/]*$/))return r=t[1],e=e.replace(/(#EXTINF:[^\n]+\n)([^\n]+)/g,function(t,e,n){return""+e+r+"/"+n+(-1<n.indexOf("?")?"&":"?")+"_s=enc"});console.warn("no match base url found.")})(s,e),i.set("Content-Length",new Blob([t]).size),n(new Response(t,{status:200,headers:i}))):(b||console.error("no player client!"),clients.get(b).then(function(t){t.postMessage({scope:h,name:d,payload:{buffer:e,url:s,playlistUrl:(t=>{var e,n=(t=>{var e;try{e=/\/([^/?]+)(\?|$)/.exec(t)[1]}catch(t){}return e})(t);return n||console.warn("no fragUrlBase"),Object.keys(O).some(function(t){return-1<O[t].indexOf(n)&&(e=t,!0)}),e})(s)}},[e]),x(d,{url:s},"send")})))}).catch(function(t){console.log("fetch error from remote",t),e(t),delete T[s]});case 2:return t.a(2)}},t)}));return function(t,e){return n.apply(this,arguments)}})()))},t)}))())}}}),self.addEventListener("message",function(t){var e=t.data;if((i=e)&&i.scope===h){var n,r,o,i=e.name;switch(x(i,e.payload),i){case s:b=t.source.id,j=m,clients.get(b).then(function(t){t.postMessage({scope:h,name:u,payload:{version:"2.33.1"}})});break;case p:E();break;case v:e.payload&&(n=e.payload,r=T[n.url])&&(delete T[n.url],(o=r.headers).set("Content-Length",n.buffer.byteLength),r.resolve(new Response(n.buffer,{status:200,headers:o})),x(v,n,"send"))}}})},{"es6-promise":1}]},{},[3])(3)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aliyun-aliplayer",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.1",
|
|
4
4
|
"description": "阿里云 Web 播放器",
|
|
5
5
|
"main": "./build/aliplayer-min",
|
|
6
6
|
"style": "./build/skins/default/aliplayer-min.css",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test:unit": "karma start",
|
|
26
26
|
"test:unit:watch": "karma start --no-single-run",
|
|
27
27
|
"test:e2e:install": "npx playwright install",
|
|
28
|
-
"test:e2e:test-all": "cp -r build/* e2e/pages/build && npx playwright test ; rm -rf e2e/pages/build/*",
|
|
28
|
+
"test:e2e:test-all": "npm run build && cp -r build/* e2e/pages/build && npx playwright test ; rm -rf e2e/pages/build/*",
|
|
29
29
|
"ci:e2e-test": "tnpm install && tnpm run build && cp -r ./build ./e2e/pages/build/ && npm run ci:e2e-test-install && npm run ci:e2e-test-run",
|
|
30
30
|
"ci:e2e-test-install": "PLAYWRIGHT_DOWNLOAD_HOST=https://anpm.alibaba-inc.com/mirrors/playwright playwright install chrome",
|
|
31
31
|
"ci:e2e-test-run": "playwright test --project 'Google Chrome'",
|