diff --git a/dist/react-aplayer.min.js b/dist/react-aplayer.min.js new file mode 100644 index 0000000..2475c9e --- /dev/null +++ b/dist/react-aplayer.min.js @@ -0,0 +1 @@ +!function(e,t){if("object"===typeof exports&&"object"===typeof module)module.exports=t(require("react"));else if("function"===typeof define&&define.amd)define(["react"],t);else{var n=t("object"===typeof exports?require("react"):e.react);for(var r in n)("object"===typeof exports?exports:e)[r]=n[r]}}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function a(e){if(p===setTimeout)return setTimeout(e,0);if((p===n||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(t){try{return p.call(null,e,0)}catch(t){return p.call(this,e,0)}}}function i(e){if(c===clearTimeout)return clearTimeout(e);if((c===r||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}function o(){y&&h&&(y=!1,h.length?d=h.concat(d):m=-1,d.length&&l())}function l(){if(!y){var e=a(o);y=!0;for(var t=d.length;t;){for(h=d,d=[];++m1)for(var n=1;n1?t-1:0),r=1;r2?r-2:0),i=2;i0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function a(e){return 3*e.length/4-r(e)}function i(e){var t,n,a,i,o,l,s=e.length;o=r(e),l=new c(3*s/4-o),a=o>0?s-4:s;var u=0;for(t=0,n=0;t>16&255,l[u++]=i>>8&255,l[u++]=255&i;return 2===o?(i=p[e.charCodeAt(t)]<<2|p[e.charCodeAt(t+1)]>>4,l[u++]=255&i):1===o&&(i=p[e.charCodeAt(t)]<<10|p[e.charCodeAt(t+1)]<<4|p[e.charCodeAt(t+2)]>>2,l[u++]=i>>8&255,l[u++]=255&i),l}function o(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}function l(e,t,n){for(var r,a=[],i=t;ip?p:s+o));return 1===r?(t=e[n-1],a+=u[t>>2],a+=u[t<<4&63],a+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],a+=u[t>>10],a+=u[t>>4&63],a+=u[t<<2&63],a+="="),i.push(a),i.join("")}t.byteLength=a,t.toByteArray=i,t.fromByteArray=s;for(var u=[],p=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,d=f.length;h=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),i.alloc(+e)}function m(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return M(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function v(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,l=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,l/=2,s/=2,n/=2}var u;if(a){var p=-1;for(u=n;ul&&(n=l-s),u=n;u>=0;u--){for(var c=!0,f=0;fa&&(r=a):r=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+l<=n){var s,u,p,c;switch(l){case 1:i<128&&(o=i);break;case 2:128==(192&(s=e[a+1]))&&(c=(31&i)<<6|63&s)>127&&(o=c);break;case 3:s=e[a+1],u=e[a+2],128==(192&s)&&128==(192&u)&&(c=(15&i)<<12|(63&s)<<6|63&u)>2047&&(c<55296||c>57343)&&(o=c);break;case 4:s=e[a+1],u=e[a+2],p=e[a+3],128==(192&s)&&128==(192&u)&&128==(192&p)&&(c=(15&i)<<18|(63&s)<<12|(63&u)<<6|63&p)>65535&&c<1114112&&(o=c)}}null===o?(o=65533,l=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),a+=l}return S(r)}function S(e){var t=e.length;if(t<=$)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var a="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function U(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-n,2);a>>8*(r?a:1-a)}function j(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-n,4);a>>8*(r?a:3-a)&255}function Y(e,t,n,r,a,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function q(e,t,n,r,a){return a||Y(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,a){return a||Y(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(e,t,n,r,52,8),n+8}function _(e){if(e=J(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function J(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){t=t||1/0;for(var n,r=e.length,a=null,i=[],o=0;o55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){for(var t=[],n=0;n>8,a=n%256,i.push(a),i.push(r);return i}function G(e){return W.toByteArray(_(e))}function Z(e,t,n,r){for(var a=0;a=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function Q(e){return e!==e}var W=n(1),K=n(6),X=n(7);t.Buffer=i,t.SlowBuffer=y,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,n){return o(null,e,t,n)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,n){return s(null,e,t,n)},i.allocUnsafe=function(e){return u(null,e)},i.allocUnsafeSlow=function(e){return u(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,a=0,o=Math.min(n,r);a0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},i.prototype.compare=function(e,t,n,r,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,a>>>=0,this===e)return 0;for(var o=a-r,l=n-t,s=Math.min(o,l),u=this.slice(r,a),p=e.slice(t,n),c=0;ca)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":return x(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return B(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(a*=256);)r+=this[e+--t]*a;return r},i.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],a=1,i=0;++i=a&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,a=1,i=this[e+--r];r>0&&(a*=256);)i+=this[e+--r]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),K.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),K.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),K.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),K.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);P(this,e,t,n,a-1,-a)}var i=0,o=1,l=0;for(this[t]=255&e;++i>0)-l&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);P(this,e,t,n,a-1,-a)}var i=n-1,o=1,l=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===l&&0!==this[t+i+1]&&(l=1),this[t+i]=(e/o>>0)-l&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--a)e[a+t]=this[a+n];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>1,p=-7,c=n?a-1:0,f=n?-1:1,h=e[t+c];for(c+=f,i=h&(1<<-p)-1,h>>=-p,p+=l;p>0;i=256*i+e[t+c],c+=f,p-=8);for(o=i&(1<<-p)-1,i>>=-p,p+=r;p>0;o=256*o+e[t+c],c+=f,p-=8);if(0===i)i=1-u;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,r),i-=u}return(h?-1:1)*o*Math.pow(2,i-r)},t.write=function(e,t,n,r,a,i){var o,l,s,u=8*i-a-1,p=(1<>1,f=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,d=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,o=p):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+c>=1?f/s:f*Math.pow(2,1-c),t*s>=2&&(o++,s/=2),o+c>=p?(l=0,o=p):o+c>=1?(l=(t*s-1)*Math.pow(2,a),o+=c):(l=t*Math.pow(2,c-1)*Math.pow(2,a),o=0));a>=8;e[n+h]=255&l,h+=d,l/=256,a-=8);for(o=o<0;e[n+h]=255&o,h+=d,o/=256,u-=8);e[n+h-d]|=128*y}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var a=e[r];"."===a?e.splice(r,1):".."===a?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!a;i--){var o=i>=0?arguments[i]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,a="/"===o.charAt(0))}return t=n(r(t.split("/"),function(e){return!!e}),!a).join("/"),(a?"/":"")+t||"."},t.normalize=function(e){var a=t.isAbsolute(e),i="/"===o(e,-1);return e=n(r(e.split("/"),function(e){return!!e}),!a).join("/"),e||a||(e="."),e&&i&&(e+="/"),(a?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var a=r(e.split("/")),i=r(n.split("/")),o=Math.min(a.length,i.length),l=o,s=0;s1)for(var n=1;n=0&&v.splice(t,1)}function o(e){var t=document.createElement("style");return t.type="text/css",a(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",a(e,t),t}function s(e,t){var n,r,a;if(t.singleton){var s=g++;n=m||(m=o(t)),r=u.bind(null,n,s,!1),a=u.bind(null,n,s,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),r=c.bind(null,n),a=function(){i(n),n.href&&URL.revokeObjectURL(n.href)}):(n=o(t),r=p.bind(null,n),a=function(){i(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else a()}}function u(e,t,n,r){var a=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=b(t,a);else{var i=document.createTextNode(a),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(i,o[t]):e.appendChild(i)}}function p(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function c(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([n],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(a),i&&URL.revokeObjectURL(i)}var f={},h=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}},d=h(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),y=h(function(){return document.head||document.getElementsByTagName("head")[0]}),m=null,g=0,v=[];e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");t=t||{},void 0===t.singleton&&(t.singleton=d()),void 0===t.insertAt&&(t.insertAt="bottom");var a=r(e);return n(a,t),function(e){for(var i=[],o=0;o\n \n \n \n '},this.isMobile=/mobile/i.test(window.navigator.userAgent),this.isMobile&&(t.autoplay=!1);var s={element:document.getElementsByClassName("aplayer")[0],narrow:!1,autoplay:!1,mutex:!0,showlrc:0,theme:"#b7daff",mode:"circulation"};for(var u in s)s.hasOwnProperty(u)&&!t.hasOwnProperty(u)&&(t[u]=s[u]);if(this.option=t,this.audios=[],this.mode=t.mode,this.secondToTime=function(e){if(isNaN(e))return"00:00";var t=function(e){return e<10?"0"+e:""+e},n=parseInt(e/60),r=parseInt(e-60*n),a=parseInt(n/60),i=parseInt(e/60-60*parseInt(e/60/60));return e>=3600?t(a)+":"+t(i)+":"+t(r):t(n)+":"+t(r)},this.element=this.option.element,2===this.option.showlrc||!0===this.option.showlrc){this.savelrc=[];for(var p=0;p0?t:0,t=t<1?t:1,y[e+"Bar"].style[n]=100*t+"%"},this.updateLrc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.audio.currentTime;if(i.lrcIndex>i.lrc.length-1||e=i.lrc[i.lrcIndex+1][0])for(var t=0;t=i.lrc[t][0]&&(!i.lrc[t+1]||e1&&this.element.classList.add("aplayer-withlist"),this.multiple||"circulation"===this.mode||"order"===this.mode||(this.mode="circulation"),this.getRandomOrder();for(var h='\n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n - 00:00 / 00:00\n \n
\n \n
\n
\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
    ',d=0;d\n \n '+(d+1)+'\n '+this.option.music[d].title+'\n '+this.option.music[d].author+"\n ";h+="\n
\n
",this.element.innerHTML=h,this.element.offsetWidth<300&&(this.element.getElementsByClassName("aplayer-icon-mode")[0].style.display="none"),this.ptime=this.element.getElementsByClassName("aplayer-ptime")[0],this.element.getElementsByClassName("aplayer-info")[0].offsetWidth<200&&this.element.getElementsByClassName("aplayer-time")[0].classList.add("aplayer-time-narrow");var y={};y.barWrap=this.element.getElementsByClassName("aplayer-bar-wrap")[0],this.option.narrow&&this.element.classList.add("aplayer-narrow"),this.button=this.element.getElementsByClassName("aplayer-button")[0],this.button.addEventListener("click",function(e){i.toggle()});var m=this.element.getElementsByClassName("aplayer-list")[0];m.addEventListener("click",function(e){var t=void 0;t="LI"===e.target.tagName.toUpperCase()?e.target:e.target.parentElement;var n=parseInt(t.getElementsByClassName("aplayer-list-index")[0].innerHTML)-1;n!==i.playIndex?(i.setMusic(n),i.play()):i.toggle()}),y.playedBar=this.element.getElementsByClassName("aplayer-played")[0],y.loadedBar=this.element.getElementsByClassName("aplayer-loaded")[0];var g=this.element.getElementsByClassName("aplayer-thumb")[0],v=void 0;y.barWrap.addEventListener("click",function(e){var t=e||window.event;v=y.barWrap.clientWidth;var r=(t.clientX-n(y.barWrap))/v;isNaN(i.audio.duration)?i.updateBar("played",0,"width"):(i.updateBar("played",r,"width"),i.element.getElementsByClassName("aplayer-ptime")[0].innerHTML=i.secondToTime(r*i.audio.duration),i.audio.currentTime=parseFloat(y.playedBar.style.width)/100*i.audio.duration)}),g.addEventListener("mouseover",function(){g.style.background=i.option.theme}),g.addEventListener("mouseout",function(){g.style.background="#fff"});var b=function(e){var t=e||window.event,r=(t.clientX-n(y.barWrap))/v;r=r>0?r:0,r=r<1?r:1,i.updateBar("played",r,"width"),i.option.showlrc&&i.updateLrc(parseFloat(y.playedBar.style.width)/100*i.audio.duration),i.element.getElementsByClassName("aplayer-ptime")[0].innerHTML=i.secondToTime(r*i.audio.duration)},w=function e(){document.removeEventListener("mouseup",e),document.removeEventListener("mousemove",b),isNaN(i.audio.duration)?i.updateBar("played",0,"width"):(i.audio.currentTime=parseFloat(y.playedBar.style.width)/100*i.audio.duration,i.playedTime=setInterval(function(){i.updateBar("played",i.audio.currentTime/i.audio.duration,"width"),i.option.showlrc&&i.updateLrc(),i.element.getElementsByClassName("aplayer-ptime")[0].innerHTML=i.secondToTime(i.audio.currentTime),i.trigger("playing")},100))};g.addEventListener("mousedown",function(){v=y.barWrap.clientWidth,clearInterval(i.playedTime),document.addEventListener("mousemove",b),document.addEventListener("mouseup",w)}),y.volumeBar=this.element.getElementsByClassName("aplayer-volume")[0];var E=this.element.getElementsByClassName("aplayer-volume-bar")[0];this.volumeicon=this.element.getElementsByClassName("aplayer-time")[0].getElementsByTagName("button")[0];this.element.getElementsByClassName("aplayer-volume-bar-wrap")[0].addEventListener("click",function(e){var t=e||window.event,n=(35-t.clientY+r(E))/35;n=n>0?n:0,n=n<1?n:1,i.volume(n)}),this.volumeicon.addEventListener("click",function(){i.audio.muted?(i.audio.muted=!1,i.volumeicon.className=1===i.audio.volume?"aplayer-icon aplayer-icon-volume-up":"aplayer-icon aplayer-icon-volume-down",1===i.audio.volume?(i.volumeicon.className="aplayer-icon aplayer-icon-volume-up",i.volumeicon.innerHTML=i.getSVG("volume-up")):(i.volumeicon.className="aplayer-icon aplayer-icon-volume-down",i.volumeicon.innerHTML=i.getSVG("volume-down")),i.updateBar("volume",i.audio.volume,"height")):(i.audio.muted=!0,i.volumeicon.className="aplayer-icon aplayer-icon-volume-off",i.volumeicon.innerHTML=i.getSVG("volume-off"),i.updateBar("volume",0,"height"))});var A=this.element.getElementsByClassName("aplayer-icon-mode")[0];A.addEventListener("click",function(){i.multiple?"random"===i.mode?i.mode="single":"single"===i.mode?i.mode="order":"order"===i.mode?i.mode="circulation":"circulation"===i.mode&&(i.mode="random"):"circulation"===i.mode?i.mode="order":i.mode="circulation",A.innerHTML=i.getSVG(i.mode),i.audio.loop=!(i.multiple||"order"===i.mode)}),m.style.height=m.offsetHeight+"px",this.element.getElementsByClassName("aplayer-icon-menu")[0].addEventListener("click",function(){m.classList.contains("aplayer-list-hide")?m.classList.remove("aplayer-list-hide"):m.classList.add("aplayer-list-hide")}),"random"===this.mode?this.setMusic(this.randomOrder[0]):this.setMusic(0),o.push(this)}return i(e,[{key:"setMusic",value:function(e){var t=this;void 0!==e&&(this.playIndex=e);var n=this.playIndex;this.music=this.option.music[n],this.music.pic&&(this.element.getElementsByClassName("aplayer-pic")[0].style.backgroundImage="url('"+this.music.pic+"')"),this.element.getElementsByClassName("aplayer-title")[0].innerHTML=this.music.title,this.element.getElementsByClassName("aplayer-author")[0].innerHTML=" - "+this.music.author,this.element.getElementsByClassName("aplayer-list-light")[0]&&this.element.getElementsByClassName("aplayer-list-light")[0].classList.remove("aplayer-list-light"),this.element.getElementsByClassName("aplayer-list")[0].getElementsByTagName("li")[n].classList.add("aplayer-list-light"),this.audio&&(this.pause(),this.audio.currentTime=0),this.element.getElementsByClassName("aplayer-list")[0].scrollTop=33*n,this.audios[n]?(this.audio=this.audios[n],this.audio.volume=parseInt(this.element.getElementsByClassName("aplayer-volume")[0].style.height)/100,this.audio.currentTime=0):(this.audio=document.createElement("audio"),this.audio.src=this.music.url,this.audio.preload=this.option.preload?this.option.preload:"auto",this.audio.addEventListener("play",function(){if(t.button.classList.contains("aplayer-play")){if(t.button.classList.remove("aplayer-play"),t.button.classList.add("aplayer-pause"),t.button.innerHTML="",setTimeout(function(){t.button.innerHTML='\n "},100),t.option.mutex)for(var e=0;e'+t.getSVG("play")+" "},100),clearInterval(t.playedTime),t.trigger("pause"))}),this.audio.addEventListener("durationchange",function(){1!==t.audio.duration&&(t.element.getElementsByClassName("aplayer-dtime")[0].innerHTML=t.secondToTime(t.audio.duration))}),this.audio.addEventListener("progress",function(){var e=t.audio.buffered.length?t.audio.buffered.end(t.audio.buffered.length-1)/t.audio.duration:0;t.updateBar("loaded",e,"width")}),this.audio.addEventListener("error",function(){t.element.getElementsByClassName("aplayer-author")[0].innerHTML=" - Error happens ╥﹏╥",t.trigger("pause")}),this.audio.addEventListener("canplay",function(){t.trigger("canplay")}),this.ended=!1,this.audio.addEventListener("ended",function(){if(t.multiple){if(t.isMobile)return t.ended=!0,void t.pause();0!==t.audio.currentTime&&("random"===t.mode?t.setMusic(t.nextRandomNum()):"single"===t.mode?t.setMusic(t.playIndex):"order"===t.mode?t.playIndex=200&&l.status<300||304===l.status?(i=l.responseText,t.lrcs[a]=r(i)):(console.log("Request was unsuccessful: "+l.status),t.lrcs[a]=[["00:00","Not available"]]),t.lrc=t.lrcs[a];var e="";t.lrcContents=t.element.getElementsByClassName("aplayer-lrc-contents")[0];for(var n=0;n"+t.lrc[n][1]+"

";t.lrcContents.innerHTML=e,t.lrcIndex||(t.lrcIndex=0),t.lrcContents.getElementsByTagName("p")[0].classList.add("aplayer-lrc-current"),t.lrcContents.style.transform="translateY(0px)",t.lrcContents.style.webkitTransform="translateY(0px)"}};var s=void 0;s=this.option.music[a].lrc,l.open("get",s,!0),l.send(null)}i?this.lrcs[a]=r(i):3===this.option.showlrc?this.lrcs[a]=[["00:00","Loading"]]:this.lrcs[a]=[["00:00","Not available"]]}this.lrc=this.lrcs[a];var u="";this.lrcContents=this.element.getElementsByClassName("aplayer-lrc-contents")[0];for(var p=0;p"+this.lrc[p][1]+"

";this.lrcContents.innerHTML=u,this.lrcIndex||(this.lrcIndex=0),this.lrcContents.getElementsByTagName("p")[0].classList.add("aplayer-lrc-current"),this.lrcContents.style.transform="translateY(0px)",this.lrcContents.style.webkitTransform="translateY(0px)"}1!==this.audio.duration&&(this.element.getElementsByClassName("aplayer-dtime")[0].innerHTML=this.audio.duration?this.secondToTime(this.audio.duration):"00:00"),this.option.autoplay&&!this.isMobile&&this.play(),this.option.autoplay=!0,this.isMobile&&this.pause()}},{key:"play",value:function(e){"[object Number]"===Object.prototype.toString.call(e)&&(this.audio.currentTime=e),this.audio.paused&&this.audio.play()}},{key:"pause",value:function(){this.audio.paused||this.audio.pause()}},{key:"volume",value:function(e){this.updateBar("volume",e,"height"),this.audio.volume=e,this.audio.muted&&(this.audio.muted=!1),1===e?(this.volumeicon.className="aplayer-icon aplayer-icon-volume-up",this.volumeicon.innerHTML=this.getSVG("volume-up")):(this.volumeicon.className="aplayer-icon aplayer-icon-volume-down",this.volumeicon.innerHTML=this.getSVG("volume-down"))}},{key:"on",value:function(e,t){"function"==typeof t&&this.event[e].push(t)}},{key:"toggle",value:function(){this.button.classList.contains("aplayer-play")?this.play():this.button.classList.contains("aplayer-pause")&&this.pause()}},{key:"getRandomOrder",value:function(){function e(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))}this.multiple&&(this.randomOrder=function(t){for(var n,r=t.length,a=new Array(r),i=0;i\n \n '+(this.option.music.length-e.length+a+1)+'\n '+e[a].title+'\n '+e[a].author+"\n ";n.innerHTML+=r,this.multiple||(this.multiple=!0,this.element.classList.add("aplayer-withlist"),this.audio.loop=!1),t.style.height="auto",t.style.height=t.offsetHeight+"px",this.getRandomOrder()}}]),e}();e.exports=l}])})}])}); \ No newline at end of file diff --git a/package.json b/package.json index d3700c3..9da6c4a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-aplayer", - "version": "0.1.0", - "main": "src/react-aplayer.js", + "version": "0.1.2", + "main": "dist/react-aplayer.min.js", "author": "Sabrina Luo ", "homepage": "http://sabrinaluo.github.io/react-aplayer", "description": "A React wrapper component of APlayer", diff --git a/src/app.js b/src/app.js index 90c18f0..6b646ff 100644 --- a/src/app.js +++ b/src/app.js @@ -26,7 +26,7 @@ export default class App extends React.Component {

Normal

{ const player = ap.state.control; - + const methods = ['play', 'pause', 'toggle', 'volume', 'addMusic', 'destroy']; methods.forEach(method => { this[method] = player[method].bind(player);