Files
ArtPlayer/dist/artplayer-plugin-flv.js
T
2018-12-17 15:18:03 +08:00

9 lines
4.8 KiB
JavaScript

/*!
* artplayer-plugin-flv.js v1.0.5
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2018 Harvey Zack
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["artplayer-plugin-flv"]={})}(this,function(t){"use strict";var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var e=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t};function n(t,e){return t(e={exports:{}},e.exports),e.exports}var i=n(function(e){function n(t){return(n="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})(t)}function o(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=o=function(t){return n(t)}:e.exports=o=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},o(t)}e.exports=o});var u=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var c=function(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?u(t):e},f=n(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n}),p=n(function(n){function o(t,e){return n.exports=o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}n.exports=o});var a=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)};function l(){}l.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,u=o.length;i<u;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}};var s=l;var y=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},d=n(function(o){function r(t,e,n){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?o.exports=r=function(t,e,n){var o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&p(r,n.prototype),r}:o.exports=r=Reflect.construct,r.apply(null,arguments)}o.exports=r}),h=function(t){function o(t,e){var n;return r(this,o),n=c(this,f(o).call(this,t)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(u(u(n)),e||n.constructor),n.name="FlvError",n}return a(o,t),o}(n(function(e){function o(t){var n="function"==typeof Map?new Map:void 0;return e.exports=o=function(t){if(null===t||!y(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return d(t,arguments,f(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),p(e,t)},o(t)}e.exports=o})(Error));function b(t,e){if(!t)throw new h(e)}var v=function t(){r(this,t);var e='video/mp4; codecs="avc1.42001E, mp4a.40.2"',n=window.document.createElement("video").canPlayType(e);b(window.MediaSource&&window.MediaSource.isTypeSupported(e)&&("probably"===n||"maybe"===n),"Unsupported MIME type or codec: ".concat(e)),b("function"==typeof window.Promise,"Unsupported 'Promise' method"),b("function"==typeof window.fetch,"Unsupported 'fetch' method")},m=function t(e){r(this,t),this.mediaSource=new MediaSource,this.url=URL.createObjectURL(this.mediaSource),e.mediaElement.src=this.url},w=function(t){function o(t,e){var n;return r(this,o),(n=c(this,f(o).call(this))).mediaElement=t,n.url=e,n.support=new v(u(u(n))),n.mediaSource=new m(u(u(n))),n}return a(o,s),e(o,[{key:"load",value:function(){console.log(this)}},{key:"destroy",value:function(){console.log(this)}}]),o}();function x(t){var n=null;return t.on("destroy",function(){n&&n.destroy()}),{flv:n,init:function(t,e){(n=new w(t,e)).load()}}}window.Flv=w,window.artplayerPluginFlv=x,t.default=x,Object.defineProperty(t,"__esModule",{value:!0})});