hls-test/video-js/alt/video.core.min.js

20 lines
227 KiB
JavaScript
Raw Normal View History

2021-10-22 18:27:02 +00:00
/**
* @license
* Video.js 7.15.4 <http://videojs.com/>
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/main/LICENSE>
*
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){"use strict";var l="7.15.4",e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}for(var n,h="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{},i={},s=function(e,t){return i[e]=i[e]||[],t&&(i[e]=i[e].concat(t)),i[e]},r=function(e,t){t=s(e).indexOf(t);return!(t<=-1)&&(i[e]=i[e].slice(),i[e].splice(t,1),!0)},o="undefined"!=typeof e?e:"undefined"!=typeof window?window:{},a="undefined"!=typeof document?document:(a=o["__GLOBAL_DOCUMENT_CACHE@4"])||(o["__GLOBAL_DOCUMENT_CACHE@4"]={}),d=a,c={prefixed:!0},u=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],p=u[0],f=0;f<u.length;f++)if(u[f][1]in d){n=u[f];break}if(n){for(var v=0;v<n.length;v++)c[p[v]]=n[v];c.prefixed=n[0]!==p[0]}var g=[],y=function(s,o){return function(e,t,n){var i,r=o.levels[t],t=new RegExp("^("+r+")$");"log"!==e&&n.unshift(e.toUpperCase()+":"),n.unshift(s+":"),g&&(g.push([].concat(n)),i=g.length-1e3,g.splice(0,0<i?i:0)),!h.console||(i=!(i=h.console[e])&&"debug"===e?h.console.info||h.console.log:i)&&r&&t.test(e)&&i[Array.isArray(n)?"apply":"call"](h.console,n)}};var _=function t(n){function i(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];s("log",r,t)}var r="info",s=y(n,i);return i.createLogger=function(e){return t(n+": "+e)},i.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},i.level=function(e){if("string"==typeof e){if(!i.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');r=e}return r},(i.history=function(){return g?[].concat(g):[]}).filter=function(t){return(g||[]).filter(function(e){return new RegExp(".*"+t+".*").test(e[0])})},i.history.clear=function(){g&&(g.length=0)},i.history.disable=function(){null!==g&&(g.length=0,g=null)},i.history.enable=function(){null===g&&(g=[])},i.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s("error",r,t)},i.warn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s("warn",r,t)},i.debug=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s("debug",r,t)},i}("VIDEOJS"),m=_.createLogger,b=t(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},t.apply(this,arguments)}e.exports=t}),T=Object.prototype.toString,k=function(e){return w(e)?Object.keys(e):[]};function C(t,n){k(t).forEach(function(e){return n(t[e],e)})}function E(n){for(var e=arguments.length,t=new Array(1<e?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Object.assign?b.apply(void 0,[n].concat(t)):(t.forEach(function(e){e&&C(e,function(e,t){n[t]=e})}),n)}function w(e){return!!e&&"object"==typeof e}function S(e){return w(e)&&"[object Object]"===T.call(e)&&e.constructor===Object}function x(e,t){if(!e||!t)return"";if("function"!=typeof h.getComputedStyle)return"";var n;try{n=h.getComputedStyle(e)}catch(e){return""}return n?n.getPropertyValue(t)||n[t]:""}var P=h.navigator&&h.navigator.userAgent||"",j=/AppleWebKit\/([\d.]
/**
* @license
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
* Copyright (c) 2014 David Björklund
* Available under the MIT license
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
*/
var Qt=function(e){var i={};return e&&e.trim().split("\n").forEach(function(e){var t=e.indexOf(":"),n=e.slice(0,t).trim().toLowerCase(),t=e.slice(t+1).trim();"undefined"==typeof i[n]?i[n]=t:Array.isArray(i[n])?i[n].push(t):i[n]=[i[n],t]}),i},Jt=en,A=en;function Zt(e,t,n){var i=e;return Gt(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=b({},t,{uri:e}),i.callback=n,i}function en(e,t,n){return tn(t=Zt(e,t,n))}function tn(i){if("undefined"==typeof i.callback)throw new Error("callback argument missing");var r=!1,s=function(e,t,n){r||(r=!0,i.callback(e,t,n))};function o(){var e=void 0,e=c.response||c.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(c);if(v)try{e=JSON.parse(e)}catch(e){}return e}function t(e){return clearTimeout(l),(e=!(e instanceof Error)?new Error(""+(e||"Unknown XMLHttpRequest Error")):e).statusCode=0,s(e,g)}function e(){if(!a){clearTimeout(l);var e=i.useXDR&&void 0===c.status?200:1223===c.status?204:c.status,t=g,n=null;return 0!==e?(t={body:o(),statusCode:e,method:h,headers:{},url:u,rawRequest:c},c.getAllResponseHeaders&&(t.headers=Qt(c.getAllResponseHeaders()))):n=new Error("Internal XMLHttpRequest Error"),s(n,t,t.body)}}var n,a,l,c=i.xhr||null,u=(c=c||new(i.cors||i.useXDR?en.XDomainRequest:en.XMLHttpRequest)).url=i.uri||i.url,h=c.method=i.method||"GET",d=i.body||i.data,p=c.headers=i.headers||{},f=!!i.sync,v=!1,g={body:void 0,headers:{},statusCode:0,method:h,url:u,rawRequest:c};if("json"in i&&!1!==i.json&&(v=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==h&&"HEAD"!==h&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),d=JSON.stringify(!0===i.json?d:i.json))),c.onreadystatechange=function(){4===c.readyState&&setTimeout(e,0)},c.onload=e,c.onerror=t,c.onprogress=function(){},c.onabort=function(){a=!0},c.ontimeout=t,c.open(h,u,!f,i.username,i.password),f||(c.withCredentials=!!i.withCredentials),!f&&0<i.timeout&&(l=setTimeout(function(){var e;a||(a=!0,c.abort("timeout"),(e=new Error("XMLHttpRequest timeout")).code="ETIMEDOUT",t(e))},i.timeout)),c.setRequestHeader)for(n in p)p.hasOwnProperty(n)&&c.setRequestHeader(n,p[n]);else if(i.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return;return 1}(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(c.responseType=i.responseType),"beforeSend"in i&&"function"==typeof i.beforeSend&&i.beforeSend(c),c.send(d||null),c}en.XMLHttpRequest=h.XMLHttpRequest||function(){},en.XDomainRequest="withCredentials"in new en.XMLHttpRequest?en.XMLHttpRequest:h.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(i){en["delete"===i?"del":i]=function(e,t,n){return(t=Zt(e,t,n)).method=i.toUpperCase(),tn(t)}}),Jt.default=A;function nn(e,t){var n=new h.WebVTT.Parser(h,h.vttjs,h.WebVTT.StringDecoder()),i=[];n.oncue=function(e){t.addCue(e)},n.onparsingerror=function(e){i.push(e)},n.onflush=function(){t.trigger({type:"loadeddata",target:t})},n.parse(e),0<i.length&&(h.console&&h.console.groupCollapsed&&h.console.groupCollapsed("Text Track parsing errors for "+t.src),i.forEach(function(e){return _.error(e)}),h.console&&h.console.groupEnd&&h.console.groupEnd()),n.flush()}function rn(e,i){var t={uri:e};(e=Vt(e))&&(t.cors=e),(e="use-credentials"===i.tech_.crossOrigin())&&(t.withCredentials=e),Jt(t,Xe(this,function(e,t,n){return e?_.error(e,t):(i.loaded_=!0,void("function"!=typeof h.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],function(e){return"vttjserror"!==e.type?nn(n,i):void _.error("vttjs failed to load, stopping trying to process "+i.src)}):nn(n,i)))}))}var sn=function(l){function e(e){var t;if(!(e=void 0===e?{}:e).tech)throw new Error("A tech was not provided.");var e=pt(e,{kind:qt[e.kind]||"subtitles",language:e.language||e.srclang||""}),n=Xt[e.mode]||"disabled",i=e.default;"metadata"!==e.kind&&"chapters"!==e.kind||(n="hidden"),(t=l.c