YNICTE/FO/js/video.js

30 lines
558 KiB
JavaScript
Raw Permalink Normal View History

/**
* @license
* Video.js 7.7.6 <http://videojs.com/>
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/master/LICENSE>
*
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
*/
!function (e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t(require("global/window"), require("global/document")) : "function" == typeof define && define.amd ? define(["global/window", "global/document"], t) : (e = e || self).videojs = t(e.window, e.document) }(this, function (y, h) {
"use strict"; y = y && y.hasOwnProperty("default") ? y.default : y, h = h && h.hasOwnProperty("default") ? h.default : h; var d = "7.7.6", l = [], e = function (o, u) { return function (e, t, i) { var n = u.levels[t], r = new RegExp("^(" + n + ")$"); if ("log" !== e && i.unshift(e.toUpperCase() + ":"), i.unshift(o + ":"), l) { l.push([].concat(i)); var a = l.length - 1e3; l.splice(0, 0 < a ? a : 0) } if (y.console) { var s = y.console[e]; s || "debug" !== e || (s = y.console.info || y.console.log), s && n && r.test(e) && s[Array.isArray(i) ? "apply" : "call"](y.console, i) } } }; var p = function t(i) { function n() { for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)t[i] = arguments[i]; r("log", a, t) } var r, a = "info"; return r = e(i, n), n.createLogger = function (e) { return t(i + ": " + e) }, n.levels = { all: "debug|log|warn|error", off: "", debug: "debug|log|warn|error", info: "log|warn|error", warn: "warn|error", error: "error", DEFAULT: a }, n.level = function (e) { if ("string" == typeof e) { if (!n.levels.hasOwnProperty(e)) throw new Error('"' + e + '" in not a valid log level'); a = e } return a }, (n.history = function () { return l ? [].concat(l) : [] }).filter = function (t) { return (l || []).filter(function (e) { return new RegExp(".*" + t + ".*").test(e[0]) }) }, n.history.clear = function () { l && (l.length = 0) }, n.history.disable = function () { null !== l && (l.length = 0, l = null) }, n.history.enable = function () { null === l && (l = []) }, n.error = function () { for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)t[i] = arguments[i]; return r("error", a, t) }, n.warn = function () { for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)t[i] = arguments[i]; return r("warn", a, t) }, n.debug = function () { for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)t[i] = arguments[i]; return r("debug", a, t) }, n }("VIDEOJS"), f = p.createLogger; function t(e, t) { return e(t = { exports: {} }, t.exports), t.exports } var r = t(function (e) { function t() { return e.exports = t = Object.assign || function (e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]) } return e }, t.apply(this, arguments) } e.exports = t }), i = Object.prototype.toString, a = function (e) { return o(e) ? Object.keys(e) : [] }; function s(t, i) { a(t).forEach(function (e) { return i(t[e], e) }) } function m(i) { for (var e = arguments.length, t = new Array(1 < e ? e - 1 : 0), n = 1; n < e; n++)t[n - 1] = arguments[n]; return Object.assign ? r.apply(void 0, [i].concat(t)) : (t.forEach(function (e) { e && s(e, function (e, t) { i[t] = e }) }), i) } function o(e) { return !!e && "object" == typeof e } function u(e) { return o(e) && "[object Object]" === i.call(e) && e.constructor === Object } function n(e, t) { if (!e || !t) return ""; if ("function" != typeof y.getComputedStyle) return ""; var i = y.getComputedStyle(e); return i ? i.getPropertyValue(t) || i[t] : "" } function c(e) { return "string" == typeof e && Boolean(e.trim()) } function g(e) { if (0 <= e.indexOf(" ")) throw new Error("class has illegal whitespace characters") } function v() { return h === y.document } function _(e) { return o(e) && 1 === e.nodeType } function b() { try { return y.parent !== y.self } catch (e) { return !0 } } function T(n) { return function (e, t) { if (!c(e)) return h[n](null); c(t) && (t = h.querySelector(t)); var i = _(t) ? t : h; return i[n] && i[n](e) } } function S(e, i, t, n) { void 0 === e && (e = "div"), void 0 === i && (i = {}), void 0 === t && (t = {}); var r = h.createElement(e); return Object.getOwnPropertyNames(i).forEach(function (e) { var t = i[e]; -1 !== e.indexOf("aria-") || "role" === e || "type" === e ? (p.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set " + e + " to " + t + "."), r.setAttribute(e, t)) : "textContent" === e ? k(r, t) : r[
/**
* @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>
*/, $t = Object.prototype.toString; var Qt = function (e) { var r = {}; return e && e.trim().split("\n").forEach(function (e) { var t = e.indexOf(":"), i = e.slice(0, t).trim().toLowerCase(), n = e.slice(t + 1).trim(); "undefined" == typeof r[i] ? r[i] = n : Array.isArray(r[i]) ? r[i].push(n) : r[i] = [r[i], n] }), r }, Jt = ti, Zt = ti; function ei(e, t, i) { var n = e; return Yt(t) ? (i = t, "string" == typeof e && (n = { uri: e })) : n = r({}, t, { uri: e }), n.callback = i, n } function ti(e, t, i) { return ii(t = ei(e, t, i)) } function ii(n) { if ("undefined" == typeof n.callback) throw new Error("callback argument missing"); var r = !1, a = function (e, t, i) { r || (r = !0, n.callback(e, t, i)) }; function t(e) { return clearTimeout(o), e instanceof Error || (e = new Error("" + (e || "Unknown XMLHttpRequest Error"))), e.statusCode = 0, a(e, m) } function e() { if (!s) { var e; clearTimeout(o), e = n.useXDR && void 0 === u.status ? 200 : 1223 === u.status ? 204 : u.status; var t = m, i = null; return 0 !== e ? (t = { body: function () { var e = void 0; if (e = u.response ? u.response : u.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 }(u), f) try { e = JSON.parse(e) } catch (e) { } return e }(), statusCode: e, method: c, headers: {}, url: l, rawRequest: u }, u.getAllResponseHeaders && (t.headers = Qt(u.getAllResponseHeaders()))) : i = new Error("Internal XMLHttpRequest Error"), a(i, t, t.body) } } var i, s, o, u = n.xhr || null, l = (u = u || (n.cors || n.useXDR ? new ti.XDomainRequest : new ti.XMLHttpRequest)).url = n.uri || n.url, c = u.method = n.method || "GET", h = n.body || n.data, d = u.headers = n.headers || {}, p = !!n.sync, f = !1, m = { body: void 0, headers: {}, statusCode: 0, method: c, url: l, rawRequest: u }; if ("json" in n && !1 !== n.json && (f = !0, d.accept || d.Accept || (d.Accept = "application/json"), "GET" !== c && "HEAD" !== c && (d["content-type"] || d["Content-Type"] || (d["Content-Type"] = "application/json"), h = JSON.stringify(!0 === n.json ? h : n.json))), u.onreadystatechange = function () { 4 === u.readyState && setTimeout(e, 0) }, u.onload = e, u.onerror = t, u.onprogress = function () { }, u.onabort = function () { s = !0 }, u.ontimeout = t, u.open(c, l, !p, n.username, n.password), p || (u.withCredentials = !!n.withCredentials), !p && 0 < n.timeout && (o = setTimeout(function () { if (!s) { s = !0, u.abort("timeout"); var e = new Error("XMLHttpRequest timeout"); e.code = "ETIMEDOUT", t(e) } }, n.timeout)), u.setRequestHeader) for (i in d) d.hasOwnProperty(i) && u.setRequestHeader(i, d[i]); else if (n.headers && !function (e) { for (var t in e) if (e.hasOwnProperty(t)) return !1; return !0 }(n.headers)) throw new Error("Headers cannot be set on an XDomainRequest object"); return "responseType" in n && (u.responseType = n.responseType), "beforeSend" in n && "function" == typeof n.beforeSend && n.beforeSend(u), u.send(h || null), u } ti.XMLHttpRequest = y.XMLHttpRequest || function () { }, ti.XDomainRequest = "withCredentials" in new ti.XMLHttpRequest ? ti.XMLHttpRequest : y.XDomainRequest, function (e, t) { for (var i = 0; i < e.length; i++)t(e[i]) }(["get", "put", "post", "patch", "head", "delete"], function (n) { ti["delete" === n ? "del" : n] = function (e, t, i) { return (t = ei(e, t, i)).method = n.toUpperCase(), ii(t) } }), Jt.default = Zt; function ni(e, t) { var i = new y.WebVTT.Parser(y, y.vttjs, y.WebVTT.StringDecoder()), n = []; i.oncue = function (e) { t.addCue(e) }, i.onparsingerror = function (e) { n.push(e) }, i.onflush = function () { t.trigger({ type: "loadeddata", target: t }) }, i.parse(e), 0 < n.length && (y.console && y.console.groupCollapsed && y.console.groupCollapsed("Text Track parsing errors for " + t.src), n.forEach(function (e) { return p.error(e) }), y.console && y.console.groupEnd && y.console.groupEnd()), i.flush() } function ri(e, n) { v
/*! @name m3u8-parser @version 4.4.0 @license Apache-2.0 */function ca() { return (ca = Object.assign || function (e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]) } return e }).apply(this, arguments) } function ha(e, t) { e.prototype = Object.create(t.prototype), (e.prototype.constructor = e).__proto__ = t } function da(e) { for (var t, i = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), n = {}, r = i.length; r--;)"" !== i[r] && ((t = /([^=]*)=(.*)/.exec(i[r]).slice(1))[0] = t[0].replace(/^\s+|\s+$/g, ""), t[1] = t[1].replace(/^\s+|\s+$/g, ""), t[1] = t[1].replace(/^['"](.*)['"]$/g, "$1"), n[t[0]] = t[1]); return n } var pa = function () { function e() { this.listeners = {} } var t = e.prototype; return t.on = function (e, t) { this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t) }, t.off = function (e, t) { if (!this.listeners[e]) return !1; var i = this.listeners[e].indexOf(t); return this.listeners[e].splice(i, 1), -1 < i }, t.trigger = function (e, t) { var i, n, r, a = this.listeners[e]; if (a) if (2 === arguments.length) for (n = a.length, i = 0; i < n; ++i)a[i].call(this, t); else for (r = Array.prototype.slice.call(arguments, 1), n = a.length, i = 0; i < n; ++i)a[i].apply(this, r) }, t.dispose = function () { this.listeners = {} }, t.pipe = function (t) { this.on("data", function (e) { t.push(e) }) }, e }(), fa = function (t) { function e() { var e; return (e = t.call(this) || this).buffer = "", e } return ha(e, t), e.prototype.push = function (e) { var t; for (this.buffer += e, t = this.buffer.indexOf("\n"); -1 < t; t = this.buffer.indexOf("\n"))this.trigger("data", this.buffer.substring(0, t)), this.buffer = this.buffer.substring(t + 1) }, e }(pa), ma = function (t) { function e() { var e; return (e = t.call(this) || this).customParsers = [], e.tagMappers = [], e } ha(e, t); var i = e.prototype; return i.push = function (n) { var u, l, c = this; 0 !== (n = n.trim()).length && ("#" === n[0] ? this.tagMappers.reduce(function (e, t) { var i = t(n); return i === n ? e : e.concat([i]) }, [n]).forEach(function (e) { for (var t = 0; t < c.customParsers.length; t++)if (c.customParsers[t].call(c, e)) return; if (0 === e.indexOf("#EXT")) if (e = e.replace("\r", ""), u = /^#EXTM3U/.exec(e)) c.trigger("data", { type: "tag", tagType: "m3u" }); else { if (u = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return l = { type: "tag", tagType: "inf" }, u[1] && (l.duration = parseFloat(u[1])), u[2] && (l.title = u[2]), void c.trigger("data", l); if (u = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return l = { type: "tag", tagType: "targetduration" }, u[1] && (l.duration = parseInt(u[1], 10)), void c.trigger("data", l); if (u = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e)) return l = { type: "tag", tagType: "totalduration" }, u[1] && (l.duration = parseInt(u[1], 10)), void c.trigger("data", l); if (u = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return l = { type: "tag", tagType: "version" }, u[1] && (l.version = parseInt(u[1], 10)), void c.trigger("data", l); if (u = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return l = { type: "tag", tagType: "media-sequence" }, u[1] && (l.number = parseInt(u[1], 10)), void c.trigger("data", l); if (u = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return l = { type: "tag", tagType: "discontinuity-sequence" }, u[1] && (l.number = parseInt(u[1], 10)), void c.trigger("data", l); if (u = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return l = { type: "tag", tagType: "playlist-type" }, u[1] && (l.playlistType = u[1]), void c.trigger("data", l); if (u = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e)) return l = { type: "tag", tagType: "byterange" }, u[1] && (l.length = parseInt(u[1], 10)), u[2] && (l.offset = parseInt(u[2], 10)), void c.trigger("data", l); if (u = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return l = { type: "tag", tagType: "allow-cache" }, u[1] && (l.allowed = !/NO/.test(u[1])), void c.trigger("data", l); if (u = /^#EXT-X-MAP:?(.*)$/.exec(e)) {
/**
* @videojs/http-streaming
* @version 1.12.3
* @copyright 2020 Brightcove, Inc
* @license Apache-2.0
*/
var ol = function (e, t, i) { return t && ul(e.prototype, t), i && ul(e, i), e }; function ul(e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n) } } function ll(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) } function cl(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 hl(r, a) { ["AUDIO", "SUBTITLES"].forEach(function (e) { for (var t in r.mediaGroups[e]) for (var i in r.mediaGroups[e][t]) { var n = r.mediaGroups[e][t][i]; a(n, e, t, i) } }) } function dl(e, t) { var i = yl(e, {}), n = i.playlists[t.id]; if (!n) return null; if (n.segments && t.segments && n.segments.length === t.segments.length && n.endList === t.endList && n.mediaSequence === t.mediaSequence) return null; var r = yl(n, t); n.segments && (r.segments = function (e, t, i) { var n = t.slice(); i = i || 0; for (var r = Math.min(e.length, t.length + i), a = i; a < r; a++)n[a - i] = yl(e[a], n[a - i]); return n }(n.segments, t.segments, t.mediaSequence - n.mediaSequence)), r.segments.forEach(function (e) { !function (e, t) { e.resolvedUri || (e.resolvedUri = rl(t, e.uri)), e.key && !e.key.resolvedUri && (e.key.resolvedUri = rl(t, e.key.uri)), e.map && !e.map.resolvedUri && (e.map.resolvedUri = rl(t, e.map.uri)) }(e, r.resolvedUri) }); for (var a = 0; a < i.playlists.length; a++)i.playlists[a].id === t.id && (i.playlists[a] = r); return i.playlists[t.id] = r, i.playlists[t.uri] = r, i } function pl(e, t) { return e + "-" + t } function fl(e) { for (var t = e.playlists.length; t--;) { var i = e.playlists[t]; i.resolvedUri = rl(e.uri, i.uri), i.id = pl(t, i.uri), e.playlists[i.id] = i, (e.playlists[i.uri] = i).attributes || (i.attributes = {}, _l.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")) } } function ml(t) { hl(t, function (e) { e.uri && (e.resolvedUri = rl(t.uri, e.uri)) }) } function gl(e, t) { var i = e.segments[e.segments.length - 1]; return t && i && i.duration ? 1e3 * i.duration : 500 * (e.targetDuration || 10) } var vl = function (e, t) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return function (e, t) { var i = [], n = !0, r = !1, a = void 0; try { for (var s, o = e[Symbol.iterator](); !(n = (s = o.next()).done) && (i.push(s.value), !t || i.length !== t); n = !0); } catch (e) { r = !0, a = e } finally { try { !n && o.return && o.return() } finally { if (r) throw a } } return i }(e, t); throw new TypeError("Invalid attempt to destructure non-iterable instance") }, yl = sa.mergeOptions, _l = sa.log, bl = (ll(Tl, sa.EventTarget), ol(Tl, [{ key: "playlistRequestError", value: function (e, t, i) { var n = t.uri, r = t.id; this.request = null, i && (this.state = i), this.error = { playlist: this.master.playlists[r], status: e.status, message: "HLS playlist request error at URL: " + n + ".", responseText: e.responseText, code: 500 <= e.status ? 4 : 2 }, this.trigger("error") } }, { key: "haveMetadata", value: function (e, t, i) { var n = this; this.request = null, this.state = "HAVE_METADATA"; var r = new ga; this.customTagParsers.forEach(function (e) { return r.addParser(e) }), this.customTagMappers.forEach(function (e) { return r.addTagMapper(e) }), r.push(e.responseText), r.end(), r.manifest.uri = t, r.manifest.id = i, r.manifest.attributes = r.manifest.attributes || {}; var a = dl(this.master, r.manifest); this.targetDuration = r.manifest.targetDuration, a ? (this.master = a, this.media_ = this.master.playlists[i]) : this.trigger("playlistunchanged"), this.media().endList || (y.clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout
});
!function () { !function (a) { var b = a && a.videojs; b && (b.CDN_VERSION = "7.7.6") }(window) }();