sync/www/js/vjs/videojs-hlsjs-plugin.js

9 lines
236 KiB
JavaScript
Raw Normal View History

2022-01-30 20:55:25 +00:00
/**
* videojs-hlsjs-plugin
* v1.0.16
* 2022-01-30
* www.streamroot.io
* Copyright 2018
**/
!function(r){var i={};function a(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=r,a.c=i,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(r,i,function(e){return t[e]}.bind(null,i));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,r){"use strict";var r=r(1),r=(window.videojs&&(r.registerConfigPlugin(window.videojs),r.registerSourceHandler(window.videojs)),{register:r.registerSourceHandler}),i="hlsSourceHandler";window[i]||(window[i]=r)},function(e,t,r){"use strict";var C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I=r(2);function i(e){var t=this;e&&(t.srOptions_||(t.srOptions_={}),t.srOptions_.hlsjsConfig||(t.srOptions_.hlsjsConfig=e.hlsjsConfig),t.srOptions_.captionConfig||(t.srOptions_.captionConfig=e.captionConfig))}e.exports={registerSourceHandler:function(D){var e,O={};function r(f,a){a.name_="StreamrootHlsjs";var n,s=a.el(),i={},g=null,o=null,l=null,p=null,d=null,u=null,c=D(a.options_.playerId),h=c.qualityLevels&&c.qualityLevels(),m=(h&&c.hlsQualitySelector&&(a.hls={}),!1);function v(e){1===i[I.ErrorTypes.MEDIA_ERROR]?n.recoverMediaError():2===i[I.ErrorTypes.MEDIA_ERROR]?(n.swapAudioCodec(),n.recoverMediaError()):2<i[I.ErrorTypes.MEDIA_ERROR]&&(a.error=function(){return e},a.trigger("error"))}function t(e){n.nextLevel=e}function y(e,t){if(h){if("boolean"==typeof t){h[e]._enabled=t;for(var r=!0,i=0;i<h.length;i++)if(!h[i]._enabled){r=!1;break}if(r)n.currentLevel=-1;else{for(var a=h.length-1;0<=a&&!h[a]._enabled;a--);n.currentLevel=a}}return h[e]._enabled}return!1}function E(e,t){h&&(h.selectedIndex_=t.level,h.trigger({selectedIndex:t.level,type:"change"}))}function T(){var i,e;o&&(i=[],1<o.levels.length&&(e={id:-1,label:"auto",selected:-1===n.manualLevel},i.push(e)),o.levels.forEach(function(e,t){var r={};r.id=t,r.selected=t===n.manualLevel,r.label=(t=e).height?t.height+"p":t.width?Math.round(9*t.width/16)+"p":t.bitrate?t.bitrate/1e3+"kbps":0,i.push(r)}),a.trigger("loadedqualitydata",{qualityData:{video:i},qualitySwitchCallback:t}),s.removeEventListener("playing",T))}function b(){for(var e=a.audioTracks(),t=0;t<e.length;t++)if(e[t].enabled){n.audioTrack=t;break}}function S(){var e=n.audioTracks,t=a.audioTracks();if(1<e.length&&0===t.length){for(var r=0;r<e.length;r++)t.addTrack(new D.AudioTrack({id:r,kind:"alternative",label:e[r].name||e[r].lang,language:e[r].lang,enabled:r===n.audioTrack}));t.addEventListener("change",b)}}function _(e){return e.label||e.language}function R(e,t){return _(e)===_(t)&&e.kind===t.kind}function A(){for(var e=c.textTracks(),t=null,r=0;r<e.length;r++)if("showing"===e[r].mode){t=e[r];break}for(var i=s.textTracks,a=0;a<i.length;a++)"subtitles"!==i[a].kind&&"captions"!==i[a].kind||(i[a].mode=t&&R(i[a],t)?"showing":"disabled")}function k(){n.startLoad(-1),s.removeEventListener("play",k)}function L(){for(var e=function(e){for(var t=[],r=0;r<e.length;r++)"subtitles"!==e[r].kind&&"captions"!==e[r].kind||t.push(e[r]);return t}(s.textTracks),t=c.textTracks(),r=0;r<e.length;r++){for(var i,a=!1,n=0;n<t.length;n++)if(R(e[r],t[n])){a=!0;break}a||(i=e[r],c.addRemoteTextTrack({kind:i.kind,label:_(i),language:i.language,srclang:i.language},!1))}A(),m||(t.addEventListener("change",A),m=!0)}function w(e,t){o=t,function(){if(o&&(h=c.qualityLevels&&c.qualityLevels())){a.hl