UNPKG

@swarmcloud/hls

Version:

Let your viewers become your unlimitedly scalable CDN.

1 lines 3.26 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwarmCloudClapprPlugin=t():e.SwarmCloudClapprPlugin=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var p=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),s=function e(t,o,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,o);if(void 0===r){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,o,n)}if("value"in r)return r.value;var p=r.get;if(void 0!==p)return p.call(n)};window.P2pEngineHls||console.error("Please put p2p-engine script before this script"),window.Clappr||console.error("Please put clappr script before this script"),console.error("clappr-p2p-plugin is deprecated and will be removed soon, please update: https://github.com/swarm-cloud/hls-p2p-engine/blob/main/demo/clappr.html");var l=function(e){function t(e){n(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o._engine=null,o}return i(t,e),p(t,[{key:"_setup",value:function(){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_setup",this).call(this),window.P2pEngineHls.isSupported()&&(this.options.playback.hlsjsConfig||(this.options.playback.hlsjsConfig={}),this.options.playback.hlsjsConfig.p2pConfig||(this.options.playback.hlsjsConfig.p2pConfig={}),this.options.playback.hlsjsConfig.p2pConfig.hlsjsInstance=this._hls,this._engine=new window.P2pEngineHls(this.options.playback.hlsjsConfig.p2pConfig))}},{key:"stop",value:function(){this._engine&&this._engine.destroy(),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"stop",this).call(this)}},{key:"destroy",value:function(){this._engine&&this._engine.destroy(),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"name",get:function(){return"cdnbye_playback"}}]),t}(window.Clappr.HLS);l.canPlay=window.Clappr.HLS.canPlay,e.exports=window.CDNByeClapprPlugin=l}])});