\";\n return div.innerHTML.indexOf('
') > 0\n}\n\n// #3663: IE encodes newlines inside attribute values while other browsers don't\nvar shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;\n// #6828: chrome encodes content in a[href]\nvar shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;\n\n/* */\n\nvar idToTemplate = cached(function (id) {\n var el = query(id);\n return el && el.innerHTML\n});\n\nvar mount = Vue.prototype.$mount;\nVue.prototype.$mount = function (\n el,\n hydrating\n) {\n el = el && query(el);\n\n /* istanbul ignore if */\n if (el === document.body || el === document.documentElement) {\n process.env.NODE_ENV !== 'production' && warn(\n \"Do not mount Vue to or - mount to normal elements instead.\"\n );\n return this\n }\n\n var options = this.$options;\n // resolve template/el and convert to render function\n if (!options.render) {\n var template = options.template;\n if (template) {\n if (typeof template === 'string') {\n if (template.charAt(0) === '#') {\n template = idToTemplate(template);\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && !template) {\n warn(\n (\"Template element not found or is empty: \" + (options.template)),\n this\n );\n }\n }\n } else if (template.nodeType) {\n template = template.innerHTML;\n } else {\n if (process.env.NODE_ENV !== 'production') {\n warn('invalid template option:' + template, this);\n }\n return this\n }\n } else if (el) {\n template = getOuterHTML(el);\n }\n if (template) {\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && config.performance && mark) {\n mark('compile');\n }\n\n var ref = compileToFunctions(template, {\n outputSourceRange: process.env.NODE_ENV !== 'production',\n shouldDecodeNewlines: shouldDecodeNewlines,\n shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,\n delimiters: options.delimiters,\n comments: options.comments\n }, this);\n var render = ref.render;\n var staticRenderFns = ref.staticRenderFns;\n options.render = render;\n options.staticRenderFns = staticRenderFns;\n\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && config.performance && mark) {\n mark('compile end');\n measure((\"vue \" + (this._name) + \" compile\"), 'compile', 'compile end');\n }\n }\n }\n return mount.call(this, el, hydrating)\n};\n\n/**\n * Get outerHTML of elements, taking care\n * of SVG elements in IE as well.\n */\nfunction getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}\n\nVue.compile = compileToFunctions;\n\nexport default Vue;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/vue/dist/vue.esm.js\n// module id = 7+uW\n// module chunks = 0","'use strict';\n\nvar TagList = function() {\n var self = this;\n\n this.list = [];\n\n this.push = function(tag) {\n this.list.push({\n bytes: tag.bytes,\n dts: tag.dts,\n pts: tag.pts,\n keyFrame: tag.keyFrame,\n metaDataTag: tag.metaDataTag\n });\n };\n\n Object.defineProperty(this, 'length', {\n get: function() {\n return self.list.length;\n }\n });\n};\n\nmodule.exports = TagList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/mux.js/lib/flv/tag-list.js\n// module id = 7Fdp\n// module chunks = 0","'use strict';\n\nvar Stream = require('../utils/stream.js');\nvar ExpGolomb = require('../utils/exp-golomb.js');\n\nvar H264Stream, NalByteStream;\nvar PROFILES_WITH_OPTIONAL_SPS_DATA;\n\n/**\n * Accepts a NAL unit byte stream and unpacks the embedded NAL units.\n */\nNalByteStream = function() {\n var\n syncPoint = 0,\n i,\n buffer;\n NalByteStream.prototype.init.call(this);\n\n this.push = function(data) {\n var swapBuffer;\n\n if (!buffer) {\n buffer = data.data;\n } else {\n swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);\n swapBuffer.set(buffer);\n swapBuffer.set(data.data, buffer.byteLength);\n buffer = swapBuffer;\n }\n\n // Rec. ITU-T H.264, Annex B\n // scan for NAL unit boundaries\n\n // a match looks like this:\n // 0 0 1 .. NAL .. 0 0 1\n // ^ sync point ^ i\n // or this:\n // 0 0 1 .. NAL .. 0 0 0\n // ^ sync point ^ i\n\n // advance the sync point to a NAL start, if necessary\n for (; syncPoint < buffer.byteLength - 3; syncPoint++) {\n if (buffer[syncPoint + 2] === 1) {\n // the sync point is properly aligned\n i = syncPoint + 5;\n break;\n }\n }\n\n while (i < buffer.byteLength) {\n // look at the current byte to determine if we've hit the end of\n // a NAL unit boundary\n switch (buffer[i]) {\n case 0:\n // skip past non-sync sequences\n if (buffer[i - 1] !== 0) {\n i += 2;\n break;\n } else if (buffer[i - 2] !== 0) {\n i++;\n break;\n }\n\n // deliver the NAL unit if it isn't empty\n if (syncPoint + 3 !== i - 2) {\n this.trigger('data', buffer.subarray(syncPoint + 3, i - 2));\n }\n\n // drop trailing zeroes\n do {\n i++;\n } while (buffer[i] !== 1 && i < buffer.length);\n syncPoint = i - 2;\n i += 3;\n break;\n case 1:\n // skip past non-sync sequences\n if (buffer[i - 1] !== 0 ||\n buffer[i - 2] !== 0) {\n i += 3;\n break;\n }\n\n // deliver the NAL unit\n this.trigger('data', buffer.subarray(syncPoint + 3, i - 2));\n syncPoint = i - 2;\n i += 3;\n break;\n default:\n // the current byte isn't a one or zero, so it cannot be part\n // of a sync sequence\n i += 3;\n break;\n }\n }\n // filter out the NAL units that were delivered\n buffer = buffer.subarray(syncPoint);\n i -= syncPoint;\n syncPoint = 0;\n };\n\n this.flush = function() {\n // deliver the last buffered NAL unit\n if (buffer && buffer.byteLength > 3) {\n this.trigger('data', buffer.subarray(syncPoint + 3));\n }\n // reset the stream state\n buffer = null;\n syncPoint = 0;\n this.trigger('done');\n };\n};\nNalByteStream.prototype = new Stream();\n\n// values of profile_idc that indicate additional fields are included in the SPS\n// see Recommendation ITU-T H.264 (4/2013),\n// 7.3.2.1.1 Sequence parameter set data syntax\nPROFILES_WITH_OPTIONAL_SPS_DATA = {\n 100: true,\n 110: true,\n 122: true,\n 244: true,\n 44: true,\n 83: true,\n 86: true,\n 118: true,\n 128: true,\n 138: true,\n 139: true,\n 134: true\n};\n\n/**\n * Accepts input from a ElementaryStream and produces H.264 NAL unit data\n * events.\n */\nH264Stream = function() {\n var\n nalByteStream = new NalByteStream(),\n self,\n trackId,\n currentPts,\n currentDts,\n\n discardEmulationPreventionBytes,\n readSequenceParameterSet,\n skipScalingList;\n\n H264Stream.prototype.init.call(this);\n self = this;\n\n this.push = function(packet) {\n if (packet.type !== 'video') {\n return;\n }\n trackId = packet.trackId;\n currentPts = packet.pts;\n currentDts = packet.dts;\n\n nalByteStream.push(packet);\n };\n\n nalByteStream.on('data', function(data) {\n var\n event = {\n trackId: trackId,\n pts: currentPts,\n dts: currentDts,\n data: data\n };\n\n switch (data[0] & 0x1f) {\n case 0x05:\n event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr';\n break;\n case 0x06:\n event.nalUnitType = 'sei_rbsp';\n event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1));\n break;\n case 0x07:\n event.nalUnitType = 'seq_parameter_set_rbsp';\n event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1));\n event.config = readSequenceParameterSet(event.escapedRBSP);\n break;\n case 0x08:\n event.nalUnitType = 'pic_parameter_set_rbsp';\n break;\n case 0x09:\n event.nalUnitType = 'access_unit_delimiter_rbsp';\n break;\n\n default:\n break;\n }\n self.trigger('data', event);\n });\n nalByteStream.on('done', function() {\n self.trigger('done');\n });\n\n this.flush = function() {\n nalByteStream.flush();\n };\n\n /**\n * Advance the ExpGolomb decoder past a scaling list. The scaling\n * list is optionally transmitted as part of a sequence parameter\n * set and is not relevant to transmuxing.\n * @param count {number} the number of entries in this scaling list\n * @param expGolombDecoder {object} an ExpGolomb pointed to the\n * start of a scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n skipScalingList = function(count, expGolombDecoder) {\n var\n lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = expGolombDecoder.readExpGolomb();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n\n lastScale = (nextScale === 0) ? lastScale : nextScale;\n }\n };\n\n /**\n * Expunge any \"Emulation Prevention\" bytes from a \"Raw Byte\n * Sequence Payload\"\n * @param data {Uint8Array} the bytes of a RBSP from a NAL\n * unit\n * @return {Uint8Array} the RBSP without any Emulation\n * Prevention Bytes\n */\n discardEmulationPreventionBytes = function(data) {\n var\n length = data.byteLength,\n emulationPreventionBytesPositions = [],\n i = 1,\n newLength, newData;\n\n // Find all `Emulation Prevention Bytes`\n while (i < length - 2) {\n if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {\n emulationPreventionBytesPositions.push(i + 2);\n i += 2;\n } else {\n i++;\n }\n }\n\n // If no Emulation Prevention Bytes were found just return the original\n // array\n if (emulationPreventionBytesPositions.length === 0) {\n return data;\n }\n\n // Create a new array to hold the NAL unit data\n newLength = length - emulationPreventionBytesPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === emulationPreventionBytesPositions[0]) {\n // Skip this byte\n sourceIndex++;\n // Remove this position index\n emulationPreventionBytesPositions.shift();\n }\n newData[i] = data[sourceIndex];\n }\n\n return newData;\n };\n\n /**\n * Read a sequence parameter set and return some interesting video\n * properties. A sequence parameter set is the H264 metadata that\n * describes the properties of upcoming video frames.\n * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n readSequenceParameterSet = function(data) {\n var\n frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n sarScale = 1,\n expGolombDecoder, profileIdc, levelIdc, profileCompatibility,\n chromaFormatIdc, picOrderCntType,\n numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n sarRatio,\n aspectRatioIdc,\n i;\n\n expGolombDecoder = new ExpGolomb(data);\n profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc\n profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag\n levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8)\n expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id\n\n // some profiles have more optional data we don't need\n if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {\n chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();\n if (chromaFormatIdc === 3) {\n expGolombDecoder.skipBits(1); // separate_colour_plane_flag\n }\n expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8\n expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8\n expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag\n if (expGolombDecoder.readBoolean()) { // seq_scaling_matrix_present_flag\n scalingListCount = (chromaFormatIdc !== 3) ? 8 : 12;\n for (i = 0; i < scalingListCount; i++) {\n if (expGolombDecoder.readBoolean()) { // seq_scaling_list_present_flag[ i ]\n if (i < 6) {\n skipScalingList(16, expGolombDecoder);\n } else {\n skipScalingList(64, expGolombDecoder);\n }\n }\n }\n }\n }\n\n expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4\n picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();\n\n if (picOrderCntType === 0) {\n expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4\n } else if (picOrderCntType === 1) {\n expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag\n expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic\n expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field\n numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();\n for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ]\n }\n }\n\n expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames\n expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag\n\n picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();\n picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();\n\n frameMbsOnlyFlag = expGolombDecoder.readBits(1);\n if (frameMbsOnlyFlag === 0) {\n expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag\n }\n\n expGolombDecoder.skipBits(1); // direct_8x8_inference_flag\n if (expGolombDecoder.readBoolean()) { // frame_cropping_flag\n frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();\n }\n if (expGolombDecoder.readBoolean()) {\n // vui_parameters_present_flag\n if (expGolombDecoder.readBoolean()) {\n // aspect_ratio_info_present_flag\n aspectRatioIdc = expGolombDecoder.readUnsignedByte();\n switch (aspectRatioIdc) {\n case 1: sarRatio = [1, 1]; break;\n case 2: sarRatio = [12, 11]; break;\n case 3: sarRatio = [10, 11]; break;\n case 4: sarRatio = [16, 11]; break;\n case 5: sarRatio = [40, 33]; break;\n case 6: sarRatio = [24, 11]; break;\n case 7: sarRatio = [20, 11]; break;\n case 8: sarRatio = [32, 11]; break;\n case 9: sarRatio = [80, 33]; break;\n case 10: sarRatio = [18, 11]; break;\n case 11: sarRatio = [15, 11]; break;\n case 12: sarRatio = [64, 33]; break;\n case 13: sarRatio = [160, 99]; break;\n case 14: sarRatio = [4, 3]; break;\n case 15: sarRatio = [3, 2]; break;\n case 16: sarRatio = [2, 1]; break;\n case 255: {\n sarRatio = [expGolombDecoder.readUnsignedByte() << 8 |\n expGolombDecoder.readUnsignedByte(),\n expGolombDecoder.readUnsignedByte() << 8 |\n expGolombDecoder.readUnsignedByte() ];\n break;\n }\n }\n if (sarRatio) {\n sarScale = sarRatio[0] / sarRatio[1];\n }\n }\n }\n return {\n profileIdc: profileIdc,\n levelIdc: levelIdc,\n profileCompatibility: profileCompatibility,\n width: Math.ceil((((picWidthInMbsMinus1 + 1) * 16) - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale),\n height: ((2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16) - (frameCropTopOffset * 2) - (frameCropBottomOffset * 2)\n };\n };\n\n};\nH264Stream.prototype = new Stream();\n\nmodule.exports = {\n H264Stream: H264Stream,\n NalByteStream: NalByteStream\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/mux.js/lib/codecs/h264.js\n// module id = 7GJ1\n// module chunks = 0","var highPrefix = [33, 16, 5, 32, 164, 27];\nvar lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];\nvar zeroFill = function(count) {\n var a = [];\n while (count--) {\n a.push(0);\n }\n return a;\n};\n\nvar makeTable = function(metaTable) {\n return Object.keys(metaTable).reduce(function(obj, key) {\n obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) {\n return arr.concat(part);\n }, []));\n return obj;\n }, {});\n};\n\n// Frames-of-silence to use for filling in missing AAC frames\nvar coneOfSilence = {\n 96000: [highPrefix, [227, 64], zeroFill(154), [56]],\n 88200: [highPrefix, [231], zeroFill(170), [56]],\n 64000: [highPrefix, [248, 192], zeroFill(240), [56]],\n 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],\n 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],\n 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],\n 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],\n 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],\n 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]],\n 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]],\n 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]\n};\n\nmodule.exports = makeTable(coneOfSilence);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/mux.js/lib/data/silence.js\n// module id = 7JOd\n// module chunks = 0","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/object-keys/implementation.js\n// module id = 7ciz\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _stream = require('./stream');\n\nvar _stream2 = _interopRequireDefault(_stream);\n\nvar _lineStream = require('./line-stream');\n\nvar _lineStream2 = _interopRequireDefault(_lineStream);\n\nvar _parseStream = require('./parse-stream');\n\nvar _parseStream2 = _interopRequireDefault(_parseStream);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file m3u8/parser.js\n */\n\n\n/**\n * A parser for M3U8 files. The current interpretation of the input is\n * exposed as a property `manifest` on parser objects. It's just two lines to\n * create and parse a manifest once you have the contents available as a string:\n *\n * ```js\n * var parser = new m3u8.Parser();\n * parser.push(xhr.responseText);\n * ```\n *\n * New input can later be applied to update the manifest object by calling\n * `push` again.\n *\n * The parser attempts to create a usable manifest object even if the\n * underlying input is somewhat nonsensical. It emits `info` and `warning`\n * events during the parse if it encounters input that seems invalid or\n * requires some property of the manifest object to be defaulted.\n *\n * @class Parser\n * @extends Stream\n */\nvar Parser = function (_Stream) {\n _inherits(Parser, _Stream);\n\n function Parser() {\n _classCallCheck(this, Parser);\n\n var _this = _possibleConstructorReturn(this, (Parser.__proto__ || Object.getPrototypeOf(Parser)).call(this));\n\n _this.lineStream = new _lineStream2['default']();\n _this.parseStream = new _parseStream2['default']();\n _this.lineStream.pipe(_this.parseStream);\n /* eslint-disable consistent-this */\n var self = _this;\n /* eslint-enable consistent-this */\n var uris = [];\n var currentUri = {};\n // if specified, the active EXT-X-MAP definition\n var currentMap = void 0;\n // if specified, the active decryption key\n var _key = void 0;\n var noop = function noop() {};\n var defaultMediaGroups = {\n 'AUDIO': {},\n 'VIDEO': {},\n 'CLOSED-CAPTIONS': {},\n 'SUBTITLES': {}\n };\n // group segments into numbered timelines delineated by discontinuities\n var currentTimeline = 0;\n\n // the manifest is empty until the parse stream begins delivering data\n _this.manifest = {\n allowCache: true,\n discontinuityStarts: [],\n segments: []\n };\n\n // update the manifest with the m3u8 entry from the parse stream\n _this.parseStream.on('data', function (entry) {\n var mediaGroup = void 0;\n var rendition = void 0;\n\n ({\n tag: function tag() {\n // switch based on the tag type\n (({\n 'allow-cache': function allowCache() {\n this.manifest.allowCache = entry.allowed;\n if (!('allowed' in entry)) {\n this.trigger('info', {\n message: 'defaulting allowCache to YES'\n });\n this.manifest.allowCache = true;\n }\n },\n byterange: function byterange() {\n var byterange = {};\n\n if ('length' in entry) {\n currentUri.byterange = byterange;\n byterange.length = entry.length;\n\n if (!('offset' in entry)) {\n this.trigger('info', {\n message: 'defaulting offset to zero'\n });\n entry.offset = 0;\n }\n }\n if ('offset' in entry) {\n currentUri.byterange = byterange;\n byterange.offset = entry.offset;\n }\n },\n endlist: function endlist() {\n this.manifest.endList = true;\n },\n inf: function inf() {\n if (!('mediaSequence' in this.manifest)) {\n this.manifest.mediaSequence = 0;\n this.trigger('info', {\n message: 'defaulting media sequence to zero'\n });\n }\n if (!('discontinuitySequence' in this.manifest)) {\n this.manifest.discontinuitySequence = 0;\n this.trigger('info', {\n message: 'defaulting discontinuity sequence to zero'\n });\n }\n if (entry.duration > 0) {\n currentUri.duration = entry.duration;\n }\n\n if (entry.duration === 0) {\n currentUri.duration = 0.01;\n this.trigger('info', {\n message: 'updating zero segment duration to a small value'\n });\n }\n\n this.manifest.segments = uris;\n },\n key: function key() {\n if (!entry.attributes) {\n this.trigger('warn', {\n message: 'ignoring key declaration without attribute list'\n });\n return;\n }\n // clear the active encryption key\n if (entry.attributes.METHOD === 'NONE') {\n _key = null;\n return;\n }\n if (!entry.attributes.URI) {\n this.trigger('warn', {\n message: 'ignoring key declaration without URI'\n });\n return;\n }\n if (!entry.attributes.METHOD) {\n this.trigger('warn', {\n message: 'defaulting key method to AES-128'\n });\n }\n\n // setup an encryption key for upcoming segments\n _key = {\n method: entry.attributes.METHOD || 'AES-128',\n uri: entry.attributes.URI\n };\n\n if (typeof entry.attributes.IV !== 'undefined') {\n _key.iv = entry.attributes.IV;\n }\n },\n 'media-sequence': function mediaSequence() {\n if (!isFinite(entry.number)) {\n this.trigger('warn', {\n message: 'ignoring invalid media sequence: ' + entry.number\n });\n return;\n }\n this.manifest.mediaSequence = entry.number;\n },\n 'discontinuity-sequence': function discontinuitySequence() {\n if (!isFinite(entry.number)) {\n this.trigger('warn', {\n message: 'ignoring invalid discontinuity sequence: ' + entry.number\n });\n return;\n }\n this.manifest.discontinuitySequence = entry.number;\n currentTimeline = entry.number;\n },\n 'playlist-type': function playlistType() {\n if (!/VOD|EVENT/.test(entry.playlistType)) {\n this.trigger('warn', {\n message: 'ignoring unknown playlist type: ' + entry.playlist\n });\n return;\n }\n this.manifest.playlistType = entry.playlistType;\n },\n map: function map() {\n currentMap = {};\n if (entry.uri) {\n currentMap.uri = entry.uri;\n }\n if (entry.byterange) {\n currentMap.byterange = entry.byterange;\n }\n },\n 'stream-inf': function streamInf() {\n this.manifest.playlists = uris;\n this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;\n\n if (!entry.attributes) {\n this.trigger('warn', {\n message: 'ignoring empty stream-inf attributes'\n });\n return;\n }\n\n if (!currentUri.attributes) {\n currentUri.attributes = {};\n }\n _extends(currentUri.attributes, entry.attributes);\n },\n media: function media() {\n this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;\n\n if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) {\n this.trigger('warn', {\n message: 'ignoring incomplete or missing media group'\n });\n return;\n }\n\n // find the media group, creating defaults as necessary\n var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];\n\n mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {};\n mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']];\n\n // collect the rendition metadata\n rendition = {\n 'default': /yes/i.test(entry.attributes.DEFAULT)\n };\n if (rendition['default']) {\n rendition.autoselect = true;\n } else {\n rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);\n }\n if (entry.attributes.LANGUAGE) {\n rendition.language = entry.attributes.LANGUAGE;\n }\n if (entry.attributes.URI) {\n rendition.uri = entry.attributes.URI;\n }\n if (entry.attributes['INSTREAM-ID']) {\n rendition.instreamId = entry.attributes['INSTREAM-ID'];\n }\n if (entry.attributes.CHARACTERISTICS) {\n rendition.characteristics = entry.attributes.CHARACTERISTICS;\n }\n if (entry.attributes.FORCED) {\n rendition.forced = /yes/i.test(entry.attributes.FORCED);\n }\n\n // insert the new rendition\n mediaGroup[entry.attributes.NAME] = rendition;\n },\n discontinuity: function discontinuity() {\n currentTimeline += 1;\n currentUri.discontinuity = true;\n this.manifest.discontinuityStarts.push(uris.length);\n },\n 'program-date-time': function programDateTime() {\n this.manifest.dateTimeString = entry.dateTimeString;\n this.manifest.dateTimeObject = entry.dateTimeObject;\n },\n targetduration: function targetduration() {\n if (!isFinite(entry.duration) || entry.duration < 0) {\n this.trigger('warn', {\n message: 'ignoring invalid target duration: ' + entry.duration\n });\n return;\n }\n this.manifest.targetDuration = entry.duration;\n },\n totalduration: function totalduration() {\n if (!isFinite(entry.duration) || entry.duration < 0) {\n this.trigger('warn', {\n message: 'ignoring invalid total duration: ' + entry.duration\n });\n return;\n }\n this.manifest.totalDuration = entry.duration;\n },\n 'cue-out': function cueOut() {\n currentUri.cueOut = entry.data;\n },\n 'cue-out-cont': function cueOutCont() {\n currentUri.cueOutCont = entry.data;\n },\n 'cue-in': function cueIn() {\n currentUri.cueIn = entry.data;\n }\n })[entry.tagType] || noop).call(self);\n },\n uri: function uri() {\n currentUri.uri = entry.uri;\n uris.push(currentUri);\n\n // if no explicit duration was declared, use the target duration\n if (this.manifest.targetDuration && !('duration' in currentUri)) {\n this.trigger('warn', {\n message: 'defaulting segment duration to the target duration'\n });\n currentUri.duration = this.manifest.targetDuration;\n }\n // annotate with encryption information, if necessary\n if (_key) {\n currentUri.key = _key;\n }\n currentUri.timeline = currentTimeline;\n // annotate with initialization segment information, if necessary\n if (currentMap) {\n currentUri.map = currentMap;\n }\n\n // prepare for the next URI\n currentUri = {};\n },\n comment: function comment() {\n // comments are not important for playback\n }\n })[entry.type].call(self);\n });\n\n return _this;\n }\n\n /**\n * Parse the input string and update the manifest object.\n *\n * @param {String} chunk a potentially incomplete portion of the manifest\n */\n\n\n _createClass(Parser, [{\n key: 'push',\n value: function push(chunk) {\n this.lineStream.push(chunk);\n }\n\n /**\n * Flush any remaining input. This can be handy if the last line of an M3U8\n * manifest did not contain a trailing newline but the file has been\n * completely received.\n */\n\n }, {\n key: 'end',\n value: function end() {\n // flush any buffered input\n this.lineStream.push('\\n');\n }\n }]);\n\n return Parser;\n}(_stream2['default']);\n\nexports['default'] = Parser;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/m3u8-parser/es5/parser.js\n// module id = 7e9Y\n// module chunks = 0","// By default assume browserify was used to bundle app. These arguments are passed to\n// the module by browserify.\nvar bundleFn = arguments[3];\nvar sources = arguments[4];\nvar cache = arguments[5];\nvar stringify = JSON.stringify;\nvar webpack = false;\n\n// webpackBootstrap\nvar webpackBootstrapFn = function(modules) {\n // The module cache\n var installedModules = {};\n\n // The require function\n function __webpack_require__(moduleId) {\n\n // Check if module is in cache\n if(installedModules[moduleId]) {\n return installedModules[moduleId].exports;\n }\n // Create a new module (and put it into the cache)\n var module = installedModules[moduleId] = {\n i: moduleId,\n l: false,\n exports: {}\n };\n\n // Execute the module function\n modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n // Flag the module as loaded\n module.l = true;\n\n // Return the exports of the module\n return module.exports;\n }\n\n\n // expose the modules object (__webpack_modules__)\n __webpack_require__.m = modules;\n\n // expose the module cache\n __webpack_require__.c = installedModules;\n\n // define getter function for harmony exports\n __webpack_require__.d = function(exports, name, getter) {\n if(!__webpack_require__.o(exports, name)) {\n Object.defineProperty(exports, name, {\n configurable: false,\n enumerable: true,\n get: getter\n });\n }\n };\n\n // getDefaultExport function for compatibility with non-harmony modules\n __webpack_require__.n = function(module) {\n var getter = module && module.__esModule ?\n function getDefault() { return module['default']; } :\n function getModuleExports() { return module; };\n\n __webpack_require__.d(getter, 'a', getter);\n return getter;\n };\n\n // Object.prototype.hasOwnProperty.call\n __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n // __webpack_public_path__\n __webpack_require__.p = \"\";\n\n // Load entry module and return exports\n return __webpack_require__(__webpack_require__.s = entryModule);\n}\n\nif (typeof bundleFn === 'undefined') {\n // Assume this was bundled with webpack and not browserify\n webpack = true;\n bundleFn = webpackBootstrapFn;\n sources = __webpack_modules__;\n}\n\nvar bundleWithBrowserify = function(fn) {\n // with browserify we must find the module key ourselves\n var cacheKeys = Object.keys(cache);\n var fnModuleKey;\n\n for (var i = 0; i < cacheKeys.length; i++) {\n var cacheKey = cacheKeys[i];\n var cacheExports = cache[cacheKey].exports;\n\n // Using babel as a transpiler to use esmodule, the export will always\n // be an object with the default export as a property of it. To ensure\n // the existing api and babel esmodule exports are both supported we\n // check for both\n if (cacheExports === fn || cacheExports && cacheExports.default === fn) {\n fnModuleKey = cacheKey;\n break;\n }\n }\n\n // if we couldn't find one, lets make one\n if (!fnModuleKey) {\n fnModuleKey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);\n\n var fnModuleCache = {};\n\n for (var i = 0; i < cacheKeys.length; i++) {\n var cacheKey = cacheKeys[i];\n\n fnModuleCache[cacheKey] = cacheKey;\n }\n\n sources[fnModuleKey] = [\n 'function(require,module,exports){' + fn + '(self); }',\n fnModuleCache\n ];\n }\n\n var entryKey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);\n var entryCache = {};\n\n entryCache[fnModuleKey] = fnModuleKey;\n sources[entryKey] = [\n 'function(require,module,exports){' +\n // try to call default if defined to also support babel esmodule exports\n 'var f = require(' + stringify(fnModuleKey) + ');' +\n '(f.default ? f.default : f)(self);' +\n '}',\n entryCache\n ];\n\n return '(' + bundleFn + ')({'\n + Object.keys(sources).map(function(key) {\n return stringify(key) + ':['\n + sources[key][0] + ','\n + stringify(sources[key][1]) + ']';\n }).join(',')\n + '},{},[' + stringify(entryKey) + '])';\n};\n\nvar bundleWithWebpack = function(fn, fnModuleId) {\n var devMode = typeof fnModuleId === 'string';\n var sourceStrings;\n\n if (devMode) {\n sourceStrings = {};\n } else {\n sourceStrings = [];\n }\n\n Object.keys(sources).forEach(function(sKey) {\n if (!sources[sKey]) {\n return;\n }\n sourceStrings[sKey] = sources[sKey].toString();\n });\n\n var fnModuleExports = __webpack_require__(fnModuleId);\n\n // Using babel as a transpiler to use esmodule, the export will always\n // be an object with the default export as a property of it. To ensure\n // the existing api and babel esmodule exports are both supported we\n // check for both\n if (!(fnModuleExports && (fnModuleExports === fn || fnModuleExports.default === fn))) {\n var fnSourceString = sourceStrings[fnModuleId];\n\n sourceStrings[fnModuleId] = fnSourceString.substring(0, fnSourceString.length - 1) +\n '\\n' + fn.name + '();\\n}';\n }\n\n var modulesString;\n\n if (devMode) {\n // must escape quotes to support webpack loader options\n fnModuleId = stringify(fnModuleId);\n // dev mode in webpack4, modules are passed as an object\n var mappedSourceStrings = Object.keys(sourceStrings).map(function(sKey) {\n return stringify(sKey) + ':' + sourceStrings[sKey];\n });\n\n modulesString = '{' + mappedSourceStrings.join(',') + '}';\n } else {\n modulesString = '[' + sourceStrings.join(',') + ']';\n }\n\n return 'var fn = (' + bundleFn.toString().replace('entryModule', fnModuleId) + ')('\n + modulesString\n + ');\\n'\n // not a function when calling a function from the current scope\n + '(typeof fn === \"function\") && fn(self);';\n\n};\n\nmodule.exports = function webwackify(fn, fnModuleId) {\n var src;\n\n if (webpack) {\n src = bundleWithWebpack(fn, fnModuleId);\n } else {\n src = bundleWithBrowserify(fn);\n }\n\n var blob = new Blob([src], { type: 'text/javascript' });\n var URL = window.URL || window.webkitURL || window.mozURL || window.msURL;\n var workerUrl = URL.createObjectURL(blob);\n var worker = new Worker(workerUrl);\n worker.objectURL = workerUrl;\n return worker;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/webwackify/index.js\n// module id = 7zZi\n// module chunks = 0","/**\n * mux.js\n *\n * Copyright (c) 2015 Brightcove\n * All rights reserved.\n *\n * Reads in-band caption information from a video elementary\n * stream. Captions must follow the CEA-708 standard for injection\n * into an MPEG-2 transport streams.\n * @see https://en.wikipedia.org/wiki/CEA-708\n * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf\n */\n\n'use strict';\n\n// -----------------\n// Link To Transport\n// -----------------\n\n// Supplemental enhancement information (SEI) NAL units have a\n// payload type field to indicate how they are to be\n// interpreted. CEAS-708 caption content is always transmitted with\n// payload type 0x04.\nvar USER_DATA_REGISTERED_ITU_T_T35 = 4,\n RBSP_TRAILING_BITS = 128,\n Stream = require('../utils/stream');\n\n/**\n * Parse a supplemental enhancement information (SEI) NAL unit.\n * Stops parsing once a message of type ITU T T35 has been found.\n *\n * @param bytes {Uint8Array} the bytes of a SEI NAL unit\n * @return {object} the parsed SEI payload\n * @see Rec. ITU-T H.264, 7.3.2.3.1\n */\nvar parseSei = function(bytes) {\n var\n i = 0,\n result = {\n payloadType: -1,\n payloadSize: 0\n },\n payloadType = 0,\n payloadSize = 0;\n\n // go through the sei_rbsp parsing each each individual sei_message\n while (i < bytes.byteLength) {\n // stop once we have hit the end of the sei_rbsp\n if (bytes[i] === RBSP_TRAILING_BITS) {\n break;\n }\n\n // Parse payload type\n while (bytes[i] === 0xFF) {\n payloadType += 255;\n i++;\n }\n payloadType += bytes[i++];\n\n // Parse payload size\n while (bytes[i] === 0xFF) {\n payloadSize += 255;\n i++;\n }\n payloadSize += bytes[i++];\n\n // this sei_message is a 608/708 caption so save it and break\n // there can only ever be one caption message in a frame's sei\n if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {\n result.payloadType = payloadType;\n result.payloadSize = payloadSize;\n result.payload = bytes.subarray(i, i + payloadSize);\n break;\n }\n\n // skip the payload and parse the next message\n i += payloadSize;\n payloadType = 0;\n payloadSize = 0;\n }\n\n return result;\n};\n\n// see ANSI/SCTE 128-1 (2013), section 8.1\nvar parseUserData = function(sei) {\n // itu_t_t35_contry_code must be 181 (United States) for\n // captions\n if (sei.payload[0] !== 181) {\n return null;\n }\n\n // itu_t_t35_provider_code should be 49 (ATSC) for captions\n if (((sei.payload[1] << 8) | sei.payload[2]) !== 49) {\n return null;\n }\n\n // the user_identifier should be \"GA94\" to indicate ATSC1 data\n if (String.fromCharCode(sei.payload[3],\n sei.payload[4],\n sei.payload[5],\n sei.payload[6]) !== 'GA94') {\n return null;\n }\n\n // finally, user_data_type_code should be 0x03 for caption data\n if (sei.payload[7] !== 0x03) {\n return null;\n }\n\n // return the user_data_type_structure and strip the trailing\n // marker bits\n return sei.payload.subarray(8, sei.payload.length - 1);\n};\n\n// see CEA-708-D, section 4.4\nvar parseCaptionPackets = function(pts, userData) {\n var results = [], i, count, offset, data;\n\n // if this is just filler, return immediately\n if (!(userData[0] & 0x40)) {\n return results;\n }\n\n // parse out the cc_data_1 and cc_data_2 fields\n count = userData[0] & 0x1f;\n for (i = 0; i < count; i++) {\n offset = i * 3;\n data = {\n type: userData[offset + 2] & 0x03,\n pts: pts\n };\n\n // capture cc data when cc_valid is 1\n if (userData[offset + 2] & 0x04) {\n data.ccData = (userData[offset + 3] << 8) | userData[offset + 4];\n results.push(data);\n }\n }\n return results;\n};\n\nvar CaptionStream = function() {\n\n CaptionStream.prototype.init.call(this);\n\n this.captionPackets_ = [];\n\n this.ccStreams_ = [\n new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define\n new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define\n new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define\n new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define\n ];\n\n this.reset();\n\n // forward data and done events from CCs to this CaptionStream\n this.ccStreams_.forEach(function(cc) {\n cc.on('data', this.trigger.bind(this, 'data'));\n cc.on('done', this.trigger.bind(this, 'done'));\n }, this);\n\n};\n\nCaptionStream.prototype = new Stream();\nCaptionStream.prototype.push = function(event) {\n var sei, userData;\n\n // only examine SEI NALs\n if (event.nalUnitType !== 'sei_rbsp') {\n return;\n }\n\n // parse the sei\n sei = parseSei(event.escapedRBSP);\n\n // ignore everything but user_data_registered_itu_t_t35\n if (sei.payloadType !== USER_DATA_REGISTERED_ITU_T_T35) {\n return;\n }\n\n // parse out the user data payload\n userData = parseUserData(sei);\n\n // ignore unrecognized userData\n if (!userData) {\n return;\n }\n\n // Sometimes, the same segment # will be downloaded twice. To stop the\n // caption data from being processed twice, we track the latest dts we've\n // received and ignore everything with a dts before that. However, since\n // data for a specific dts can be split across 2 packets on either side of\n // a segment boundary, we need to make sure we *don't* ignore the second\n // dts packet we receive that has dts === this.latestDts_. And thus, the\n // ignoreNextEqualDts_ flag was born.\n if (event.dts < this.latestDts_) {\n // We've started getting older data, so set the flag.\n this.ignoreNextEqualDts_ = true;\n return;\n } else if ((event.dts === this.latestDts_) && (this.ignoreNextEqualDts_)) {\n // We've received the last duplicate packet, time to start processing again\n this.ignoreNextEqualDts_ = false;\n return;\n }\n\n // parse out CC data packets and save them for later\n this.captionPackets_ = this.captionPackets_.concat(parseCaptionPackets(event.pts, userData));\n this.latestDts_ = event.dts;\n};\n\nCaptionStream.prototype.flush = function() {\n // make sure we actually parsed captions before proceeding\n if (!this.captionPackets_.length) {\n this.ccStreams_.forEach(function(cc) {\n cc.flush();\n }, this);\n return;\n }\n\n // In Chrome, the Array#sort function is not stable so add a\n // presortIndex that we can use to ensure we get a stable-sort\n this.captionPackets_.forEach(function(elem, idx) {\n elem.presortIndex = idx;\n });\n\n // sort caption byte-pairs based on their PTS values\n this.captionPackets_.sort(function(a, b) {\n if (a.pts === b.pts) {\n return a.presortIndex - b.presortIndex;\n }\n return a.pts - b.pts;\n });\n\n this.captionPackets_.forEach(function(packet) {\n if (packet.type < 2) {\n // Dispatch packet to the right Cea608Stream\n this.dispatchCea608Packet(packet);\n }\n // this is where an 'else' would go for a dispatching packets\n // to a theoretical Cea708Stream that handles SERVICEn data\n }, this);\n\n this.captionPackets_.length = 0;\n this.ccStreams_.forEach(function(cc) {\n cc.flush();\n }, this);\n return;\n};\n\nCaptionStream.prototype.reset = function() {\n this.latestDts_ = null;\n this.ignoreNextEqualDts_ = false;\n this.activeCea608Channel_ = [null, null];\n this.ccStreams_.forEach(function(ccStream) {\n ccStream.reset();\n });\n};\n\nCaptionStream.prototype.dispatchCea608Packet = function(packet) {\n // NOTE: packet.type is the CEA608 field\n if (this.setsChannel1Active(packet)) {\n this.activeCea608Channel_[packet.type] = 0;\n } else if (this.setsChannel2Active(packet)) {\n this.activeCea608Channel_[packet.type] = 1;\n }\n if (this.activeCea608Channel_[packet.type] === null) {\n // If we haven't received anything to set the active channel, discard the\n // data; we don't want jumbled captions\n return;\n }\n this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);\n};\n\nCaptionStream.prototype.setsChannel1Active = function(packet) {\n return ((packet.ccData & 0x7800) === 0x1000);\n};\nCaptionStream.prototype.setsChannel2Active = function(packet) {\n return ((packet.ccData & 0x7800) === 0x1800);\n};\n\n// ----------------------\n// Session to Application\n// ----------------------\n\nvar CHARACTER_TRANSLATION = {\n 0x2a: 0xe1, // á\n 0x5c: 0xe9, // é\n 0x5e: 0xed, // í\n 0x5f: 0xf3, // ó\n 0x60: 0xfa, // ú\n 0x7b: 0xe7, // ç\n 0x7c: 0xf7, // ÷\n 0x7d: 0xd1, // Ñ\n 0x7e: 0xf1, // ñ\n 0x7f: 0x2588, // █\n 0x0130: 0xae, // ®\n 0x0131: 0xb0, // °\n 0x0132: 0xbd, // ½\n 0x0133: 0xbf, // ¿\n 0x0134: 0x2122, // ™\n 0x0135: 0xa2, // ¢\n 0x0136: 0xa3, // £\n 0x0137: 0x266a, // ♪\n 0x0138: 0xe0, // à\n 0x0139: 0xa0, //\n 0x013a: 0xe8, // è\n 0x013b: 0xe2, // â\n 0x013c: 0xea, // ê\n 0x013d: 0xee, // î\n 0x013e: 0xf4, // ô\n 0x013f: 0xfb, // û\n 0x0220: 0xc1, // Á\n 0x0221: 0xc9, // É\n 0x0222: 0xd3, // Ó\n 0x0223: 0xda, // Ú\n 0x0224: 0xdc, // Ü\n 0x0225: 0xfc, // ü\n 0x0226: 0x2018, // ‘\n 0x0227: 0xa1, // ¡\n 0x0228: 0x2a, // *\n 0x0229: 0x27, // '\n 0x022a: 0x2014, // —\n 0x022b: 0xa9, // ©\n 0x022c: 0x2120, // ℠\n 0x022d: 0x2022, // •\n 0x022e: 0x201c, // “\n 0x022f: 0x201d, // ”\n 0x0230: 0xc0, // À\n 0x0231: 0xc2, // Â\n 0x0232: 0xc7, // Ç\n 0x0233: 0xc8, // È\n 0x0234: 0xca, // Ê\n 0x0235: 0xcb, // Ë\n 0x0236: 0xeb, // ë\n 0x0237: 0xce, // Î\n 0x0238: 0xcf, // Ï\n 0x0239: 0xef, // ï\n 0x023a: 0xd4, // Ô\n 0x023b: 0xd9, // Ù\n 0x023c: 0xf9, // ù\n 0x023d: 0xdb, // Û\n 0x023e: 0xab, // «\n 0x023f: 0xbb, // »\n 0x0320: 0xc3, // Ã\n 0x0321: 0xe3, // ã\n 0x0322: 0xcd, // Í\n 0x0323: 0xcc, // Ì\n 0x0324: 0xec, // ì\n 0x0325: 0xd2, // Ò\n 0x0326: 0xf2, // ò\n 0x0327: 0xd5, // Õ\n 0x0328: 0xf5, // õ\n 0x0329: 0x7b, // {\n 0x032a: 0x7d, // }\n 0x032b: 0x5c, // \\\n 0x032c: 0x5e, // ^\n 0x032d: 0x5f, // _\n 0x032e: 0x7c, // |\n 0x032f: 0x7e, // ~\n 0x0330: 0xc4, // Ä\n 0x0331: 0xe4, // ä\n 0x0332: 0xd6, // Ö\n 0x0333: 0xf6, // ö\n 0x0334: 0xdf, // ß\n 0x0335: 0xa5, // ¥\n 0x0336: 0xa4, // ¤\n 0x0337: 0x2502, // │\n 0x0338: 0xc5, // Å\n 0x0339: 0xe5, // å\n 0x033a: 0xd8, // Ø\n 0x033b: 0xf8, // ø\n 0x033c: 0x250c, // ┌\n 0x033d: 0x2510, // ┐\n 0x033e: 0x2514, // └\n 0x033f: 0x2518 // ┘\n};\n\nvar getCharFromCode = function(code) {\n if (code === null) {\n return '';\n }\n code = CHARACTER_TRANSLATION[code] || code;\n return String.fromCharCode(code);\n};\n\n// the index of the last row in a CEA-608 display buffer\nvar BOTTOM_ROW = 14;\n\n// This array is used for mapping PACs -> row #, since there's no way of\n// getting it through bit logic.\nvar ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620,\n 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420];\n\n// CEA-608 captions are rendered onto a 34x15 matrix of character\n// cells. The \"bottom\" row is the last element in the outer array.\nvar createDisplayBuffer = function() {\n var result = [], i = BOTTOM_ROW + 1;\n while (i--) {\n result.push('');\n }\n return result;\n};\n\nvar Cea608Stream = function(field, dataChannel) {\n Cea608Stream.prototype.init.call(this);\n\n this.field_ = field || 0;\n this.dataChannel_ = dataChannel || 0;\n\n this.name_ = 'CC' + (((this.field_ << 1) | this.dataChannel_) + 1);\n\n this.setConstants();\n this.reset();\n\n this.push = function(packet) {\n var data, swap, char0, char1, text;\n // remove the parity bits\n data = packet.ccData & 0x7f7f;\n\n // ignore duplicate control codes; the spec demands they're sent twice\n if (data === this.lastControlCode_) {\n this.lastControlCode_ = null;\n return;\n }\n\n // Store control codes\n if ((data & 0xf000) === 0x1000) {\n this.lastControlCode_ = data;\n } else if (data !== this.PADDING_) {\n this.lastControlCode_ = null;\n }\n\n char0 = data >>> 8;\n char1 = data & 0xff;\n\n if (data === this.PADDING_) {\n return;\n\n } else if (data === this.RESUME_CAPTION_LOADING_) {\n this.mode_ = 'popOn';\n\n } else if (data === this.END_OF_CAPTION_) {\n this.clearFormatting(packet.pts);\n // if a caption was being displayed, it's gone now\n this.flushDisplayed(packet.pts);\n\n // flip memory\n swap = this.displayed_;\n this.displayed_ = this.nonDisplayed_;\n this.nonDisplayed_ = swap;\n\n // start measuring the time to display the caption\n this.startPts_ = packet.pts;\n\n } else if (data === this.ROLL_UP_2_ROWS_) {\n this.topRow_ = BOTTOM_ROW - 1;\n this.mode_ = 'rollUp';\n } else if (data === this.ROLL_UP_3_ROWS_) {\n this.topRow_ = BOTTOM_ROW - 2;\n this.mode_ = 'rollUp';\n } else if (data === this.ROLL_UP_4_ROWS_) {\n this.topRow_ = BOTTOM_ROW - 3;\n this.mode_ = 'rollUp';\n } else if (data === this.CARRIAGE_RETURN_) {\n this.clearFormatting(packet.pts);\n this.flushDisplayed(packet.pts);\n this.shiftRowsUp_();\n this.startPts_ = packet.pts;\n\n } else if (data === this.BACKSPACE_) {\n if (this.mode_ === 'popOn') {\n this.nonDisplayed_[BOTTOM_ROW] = this.nonDisplayed_[BOTTOM_ROW].slice(0, -1);\n } else {\n this.displayed_[BOTTOM_ROW] = this.displayed_[BOTTOM_ROW].slice(0, -1);\n }\n } else if (data === this.ERASE_DISPLAYED_MEMORY_) {\n this.flushDisplayed(packet.pts);\n this.displayed_ = createDisplayBuffer();\n } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {\n this.nonDisplayed_ = createDisplayBuffer();\n\n } else if (data === this.RESUME_DIRECT_CAPTIONING_) {\n this.mode_ = 'paintOn';\n\n // Append special characters to caption text\n } else if (this.isSpecialCharacter(char0, char1)) {\n // Bitmask char0 so that we can apply character transformations\n // regardless of field and data channel.\n // Then byte-shift to the left and OR with char1 so we can pass the\n // entire character code to `getCharFromCode`.\n char0 = (char0 & 0x03) << 8;\n text = getCharFromCode(char0 | char1);\n this[this.mode_](packet.pts, text);\n this.column_++;\n\n // Append extended characters to caption text\n } else if (this.isExtCharacter(char0, char1)) {\n // Extended characters always follow their \"non-extended\" equivalents.\n // IE if a \"è\" is desired, you'll always receive \"eè\"; non-compliant\n // decoders are supposed to drop the \"è\", while compliant decoders\n // backspace the \"e\" and insert \"è\".\n\n // Delete the previous character\n if (this.mode_ === 'popOn') {\n this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);\n } else {\n this.displayed_[BOTTOM_ROW] = this.displayed_[BOTTOM_ROW].slice(0, -1);\n }\n\n // Bitmask char0 so that we can apply character transformations\n // regardless of field and data channel.\n // Then byte-shift to the left and OR with char1 so we can pass the\n // entire character code to `getCharFromCode`.\n char0 = (char0 & 0x03) << 8;\n text = getCharFromCode(char0 | char1);\n this[this.mode_](packet.pts, text);\n this.column_++;\n\n // Process mid-row codes\n } else if (this.isMidRowCode(char0, char1)) {\n // Attributes are not additive, so clear all formatting\n this.clearFormatting(packet.pts);\n\n // According to the standard, mid-row codes\n // should be replaced with spaces, so add one now\n this[this.mode_](packet.pts, ' ');\n this.column_++;\n\n if ((char1 & 0xe) === 0xe) {\n this.addFormatting(packet.pts, ['i']);\n }\n\n if ((char1 & 0x1) === 0x1) {\n this.addFormatting(packet.pts, ['u']);\n }\n\n // Detect offset control codes and adjust cursor\n } else if (this.isOffsetControlCode(char0, char1)) {\n // Cursor position is set by indent PAC (see below) in 4-column\n // increments, with an additional offset code of 1-3 to reach any\n // of the 32 columns specified by CEA-608. So all we need to do\n // here is increment the column cursor by the given offset.\n this.column_ += (char1 & 0x03);\n\n // Detect PACs (Preamble Address Codes)\n } else if (this.isPAC(char0, char1)) {\n\n // There's no logic for PAC -> row mapping, so we have to just\n // find the row code in an array and use its index :(\n var row = ROWS.indexOf(data & 0x1f20);\n\n if (row !== this.row_) {\n // formatting is only persistent for current row\n this.clearFormatting(packet.pts);\n this.row_ = row;\n }\n // All PACs can apply underline, so detect and apply\n // (All odd-numbered second bytes set underline)\n if ((char1 & 0x1) && (this.formatting_.indexOf('u') === -1)) {\n this.addFormatting(packet.pts, ['u']);\n }\n\n if ((data & 0x10) === 0x10) {\n // We've got an indent level code. Each successive even number\n // increments the column cursor by 4, so we can get the desired\n // column position by bit-shifting to the right (to get n/2)\n // and multiplying by 4.\n this.column_ = ((data & 0xe) >> 1) * 4;\n }\n\n if (this.isColorPAC(char1)) {\n // it's a color code, though we only support white, which\n // can be either normal or italicized. white italics can be\n // either 0x4e or 0x6e depending on the row, so we just\n // bitwise-and with 0xe to see if italics should be turned on\n if ((char1 & 0xe) === 0xe) {\n this.addFormatting(packet.pts, ['i']);\n }\n }\n\n // We have a normal character in char0, and possibly one in char1\n } else if (this.isNormalChar(char0)) {\n if (char1 === 0x00) {\n char1 = null;\n }\n text = getCharFromCode(char0);\n text += getCharFromCode(char1);\n this[this.mode_](packet.pts, text);\n this.column_ += text.length;\n\n } // finish data processing\n\n };\n};\nCea608Stream.prototype = new Stream();\n// Trigger a cue point that captures the current state of the\n// display buffer\nCea608Stream.prototype.flushDisplayed = function(pts) {\n var content = this.displayed_\n // remove spaces from the start and end of the string\n .map(function(row) {\n return row.trim();\n })\n // combine all text rows to display in one cue\n .join('\\n')\n // and remove blank rows from the start and end, but not the middle\n .replace(/^\\n+|\\n+$/g, '');\n\n if (content.length) {\n this.trigger('data', {\n startPts: this.startPts_,\n endPts: pts,\n text: content,\n stream: this.name_\n });\n }\n};\n\n/**\n * Zero out the data, used for startup and on seek\n */\nCea608Stream.prototype.reset = function() {\n this.mode_ = 'popOn';\n // When in roll-up mode, the index of the last row that will\n // actually display captions. If a caption is shifted to a row\n // with a lower index than this, it is cleared from the display\n // buffer\n this.topRow_ = 0;\n this.startPts_ = 0;\n this.displayed_ = createDisplayBuffer();\n this.nonDisplayed_ = createDisplayBuffer();\n this.lastControlCode_ = null;\n\n // Track row and column for proper line-breaking and spacing\n this.column_ = 0;\n this.row_ = BOTTOM_ROW;\n\n // This variable holds currently-applied formatting\n this.formatting_ = [];\n};\n\n/**\n * Sets up control code and related constants for this instance\n */\nCea608Stream.prototype.setConstants = function() {\n // The following attributes have these uses:\n // ext_ : char0 for mid-row codes, and the base for extended\n // chars (ext_+0, ext_+1, and ext_+2 are char0s for\n // extended codes)\n // control_: char0 for control codes, except byte-shifted to the\n // left so that we can do this.control_ | CONTROL_CODE\n // offset_: char0 for tab offset codes\n //\n // It's also worth noting that control codes, and _only_ control codes,\n // differ between field 1 and field2. Field 2 control codes are always\n // their field 1 value plus 1. That's why there's the \"| field\" on the\n // control value.\n if (this.dataChannel_ === 0) {\n this.BASE_ = 0x10;\n this.EXT_ = 0x11;\n this.CONTROL_ = (0x14 | this.field_) << 8;\n this.OFFSET_ = 0x17;\n } else if (this.dataChannel_ === 1) {\n this.BASE_ = 0x18;\n this.EXT_ = 0x19;\n this.CONTROL_ = (0x1c | this.field_) << 8;\n this.OFFSET_ = 0x1f;\n }\n\n // Constants for the LSByte command codes recognized by Cea608Stream. This\n // list is not exhaustive. For a more comprehensive listing and semantics see\n // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf\n // Padding\n this.PADDING_ = 0x0000;\n // Pop-on Mode\n this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20;\n this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f;\n // Roll-up Mode\n this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25;\n this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26;\n this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27;\n this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d;\n // paint-on mode (not supported)\n this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29;\n // Erasure\n this.BACKSPACE_ = this.CONTROL_ | 0x21;\n this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c;\n this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e;\n};\n\n/**\n * Detects if the 2-byte packet data is a special character\n *\n * Special characters have a second byte in the range 0x30 to 0x3f,\n * with the first byte being 0x11 (for data channel 1) or 0x19 (for\n * data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an special character\n */\nCea608Stream.prototype.isSpecialCharacter = function(char0, char1) {\n return (char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f);\n};\n\n/**\n * Detects if the 2-byte packet data is an extended character\n *\n * Extended characters have a second byte in the range 0x20 to 0x3f,\n * with the first byte being 0x12 or 0x13 (for data channel 1) or\n * 0x1a or 0x1b (for data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an extended character\n */\nCea608Stream.prototype.isExtCharacter = function(char0, char1) {\n return ((char0 === (this.EXT_ + 1) || char0 === (this.EXT_ + 2)) &&\n (char1 >= 0x20 && char1 <= 0x3f));\n};\n\n/**\n * Detects if the 2-byte packet is a mid-row code\n *\n * Mid-row codes have a second byte in the range 0x20 to 0x2f, with\n * the first byte being 0x11 (for data channel 1) or 0x19 (for data\n * channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are a mid-row code\n */\nCea608Stream.prototype.isMidRowCode = function(char0, char1) {\n return (char0 === this.EXT_ && (char1 >= 0x20 && char1 <= 0x2f));\n};\n\n/**\n * Detects if the 2-byte packet is an offset control code\n *\n * Offset control codes have a second byte in the range 0x21 to 0x23,\n * with the first byte being 0x17 (for data channel 1) or 0x1f (for\n * data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an offset control code\n */\nCea608Stream.prototype.isOffsetControlCode = function(char0, char1) {\n return (char0 === this.OFFSET_ && (char1 >= 0x21 && char1 <= 0x23));\n};\n\n/**\n * Detects if the 2-byte packet is a Preamble Address Code\n *\n * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1)\n * or 0x18 to 0x1f (for data channel 2), with the second byte in the\n * range 0x40 to 0x7f.\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are a PAC\n */\nCea608Stream.prototype.isPAC = function(char0, char1) {\n return (char0 >= this.BASE_ && char0 < (this.BASE_ + 8) &&\n (char1 >= 0x40 && char1 <= 0x7f));\n};\n\n/**\n * Detects if a packet's second byte is in the range of a PAC color code\n *\n * PAC color codes have the second byte be in the range 0x40 to 0x4f, or\n * 0x60 to 0x6f.\n *\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the byte is a color PAC\n */\nCea608Stream.prototype.isColorPAC = function(char1) {\n return ((char1 >= 0x40 && char1 <= 0x4f) || (char1 >= 0x60 && char1 <= 0x7f));\n};\n\n/**\n * Detects if a single byte is in the range of a normal character\n *\n * Normal text bytes are in the range 0x20 to 0x7f.\n *\n * @param {Integer} char The byte\n * @return {Boolean} Whether the byte is a normal character\n */\nCea608Stream.prototype.isNormalChar = function(char) {\n return (char >= 0x20 && char <= 0x7f);\n};\n\n// Adds the opening HTML tag for the passed character to the caption text,\n// and keeps track of it for later closing\nCea608Stream.prototype.addFormatting = function(pts, format) {\n this.formatting_ = this.formatting_.concat(format);\n var text = format.reduce(function(text, format) {\n return text + '<' + format + '>';\n }, '');\n this[this.mode_](pts, text);\n};\n\n// Adds HTML closing tags for current formatting to caption text and\n// clears remembered formatting\nCea608Stream.prototype.clearFormatting = function(pts) {\n if (!this.formatting_.length) {\n return;\n }\n var text = this.formatting_.reverse().reduce(function(text, format) {\n return text + '' + format + '>';\n }, '');\n this.formatting_ = [];\n this[this.mode_](pts, text);\n};\n\n// Mode Implementations\nCea608Stream.prototype.popOn = function(pts, text) {\n var baseRow = this.nonDisplayed_[this.row_];\n\n // buffer characters\n baseRow += text;\n this.nonDisplayed_[this.row_] = baseRow;\n};\n\nCea608Stream.prototype.rollUp = function(pts, text) {\n var baseRow = this.displayed_[BOTTOM_ROW];\n\n baseRow += text;\n this.displayed_[BOTTOM_ROW] = baseRow;\n\n};\n\nCea608Stream.prototype.shiftRowsUp_ = function() {\n var i;\n // clear out inactive rows\n for (i = 0; i < this.topRow_; i++) {\n this.displayed_[i] = '';\n }\n // shift displayed rows up\n for (i = this.topRow_; i < BOTTOM_ROW; i++) {\n this.displayed_[i] = this.displayed_[i + 1];\n }\n // clear out the bottom row\n this.displayed_[BOTTOM_ROW] = '';\n};\n\n// paintOn mode is not implemented\nCea608Stream.prototype.paintOn = function() {};\n\n// exports\nmodule.exports = {\n CaptionStream: CaptionStream,\n Cea608Stream: Cea608Stream\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/mux.js/lib/m2ts/caption-stream.js\n// module id = 8Ig8\n// module chunks = 0","/*\n * pkcs7.unpad\n * https://github.com/brightcove/pkcs7\n *\n * Copyright (c) 2014 Brightcove\n * Licensed under the apache2 license.\n */\n\n'use strict';\n\n/**\n * Returns the subarray of a Uint8Array without PKCS#7 padding.\n * @param padded {Uint8Array} unencrypted bytes that have been padded\n * @return {Uint8Array} the unpadded bytes\n * @see http://tools.ietf.org/html/rfc5652\n */\nmodule.exports = function unpad(padded) {\n return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/pkcs7/lib/unpad.js\n// module id = 8xxF\n// module chunks = 0","var $isNaN = Number.isNaN || function (a) { return a !== a; };\n\nmodule.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/es-abstract/helpers/isFinite.js\n// module id = 9+gG\n// module chunks = 0","/**\n * @file add-text-track-data.js\n */\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar _globalWindow = require('global/window');\n\nvar _globalWindow2 = _interopRequireDefault(_globalWindow);\n\nvar _videoJs = require('video.js');\n\nvar _videoJs2 = _interopRequireDefault(_videoJs);\n\n/**\n * Define properties on a cue for backwards compatability,\n * but warn the user that the way that they are using it\n * is depricated and will be removed at a later date.\n *\n * @param {Cue} cue the cue to add the properties on\n * @private\n */\nvar deprecateOldCue = function deprecateOldCue(cue) {\n Object.defineProperties(cue.frame, {\n id: {\n get: function get() {\n _videoJs2['default'].log.warn('cue.frame.id is deprecated. Use cue.value.key instead.');\n return cue.value.key;\n }\n },\n value: {\n get: function get() {\n _videoJs2['default'].log.warn('cue.frame.value is deprecated. Use cue.value.data instead.');\n return cue.value.data;\n }\n },\n privateData: {\n get: function get() {\n _videoJs2['default'].log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.');\n return cue.value.data;\n }\n }\n });\n};\n\nvar durationOfVideo = function durationOfVideo(duration) {\n var dur = undefined;\n\n if (isNaN(duration) || Math.abs(duration) === Infinity) {\n dur = Number.MAX_VALUE;\n } else {\n dur = duration;\n }\n return dur;\n};\n/**\n * Add text track data to a source handler given the captions and\n * metadata from the buffer.\n *\n * @param {Object} sourceHandler the flash or virtual source buffer\n * @param {Array} captionArray an array of caption data\n * @param {Array} metadataArray an array of meta data\n * @private\n */\nvar addTextTrackData = function addTextTrackData(sourceHandler, captionArray, metadataArray) {\n var Cue = _globalWindow2['default'].WebKitDataCue || _globalWindow2['default'].VTTCue;\n\n if (captionArray) {\n captionArray.forEach(function (caption) {\n var track = caption.stream;\n\n this.inbandTextTracks_[track].addCue(new Cue(caption.startTime + this.timestampOffset, caption.endTime + this.timestampOffset, caption.text));\n }, sourceHandler);\n }\n\n if (metadataArray) {\n (function () {\n var videoDuration = durationOfVideo(sourceHandler.mediaSource_.duration);\n\n metadataArray.forEach(function (metadata) {\n var time = metadata.cueTime + this.timestampOffset;\n\n metadata.frames.forEach(function (frame) {\n var cue = new Cue(time, time, frame.value || frame.url || frame.data || '');\n\n cue.frame = frame;\n cue.value = frame;\n deprecateOldCue(cue);\n\n this.metadataTrack_.addCue(cue);\n }, this);\n }, sourceHandler);\n\n // Updating the metadeta cues so that\n // the endTime of each cue is the startTime of the next cue\n // the endTime of last cue is the duration of the video\n if (sourceHandler.metadataTrack_ && sourceHandler.metadataTrack_.cues && sourceHandler.metadataTrack_.cues.length) {\n (function () {\n var cues = sourceHandler.metadataTrack_.cues;\n var cuesArray = [];\n\n // Create a copy of the TextTrackCueList...\n // ...disregarding cues with a falsey value\n for (var i = 0; i < cues.length; i++) {\n if (cues[i]) {\n cuesArray.push(cues[i]);\n }\n }\n\n // Group cues by their startTime value\n var cuesGroupedByStartTime = cuesArray.reduce(function (obj, cue) {\n var timeSlot = obj[cue.startTime] || [];\n\n timeSlot.push(cue);\n obj[cue.startTime] = timeSlot;\n\n return obj;\n }, {});\n\n // Sort startTimes by ascending order\n var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function (a, b) {\n return Number(a) - Number(b);\n });\n\n // Map each cue group's endTime to the next group's startTime\n sortedStartTimes.forEach(function (startTime, idx) {\n var cueGroup = cuesGroupedByStartTime[startTime];\n var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration;\n\n // Map each cue's endTime the next group's startTime\n cueGroup.forEach(function (cue) {\n cue.endTime = nextTime;\n });\n });\n })();\n }\n })();\n }\n};\n\nexports['default'] = {\n addTextTrackData: addTextTrackData,\n durationOfVideo: durationOfVideo\n};\nmodule.exports = exports['default'];\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/videojs-contrib-media-sources/es5/add-text-track-data.js\n// module id = 9jeX\n// module chunks = 0","/**\n * mux.js\n *\n * Copyright (c) 2016 Brightcove\n * All rights reserved.\n *\n * Utilities to detect basic properties and metadata about Aac data.\n */\n'use strict';\n\nvar ADTS_SAMPLING_FREQUENCIES = [\n 96000,\n 88200,\n 64000,\n 48000,\n 44100,\n 32000,\n 24000,\n 22050,\n 16000,\n 12000,\n 11025,\n 8000,\n 7350\n];\n\nvar parseSyncSafeInteger = function(data) {\n return (data[0] << 21) |\n (data[1] << 14) |\n (data[2] << 7) |\n (data[3]);\n};\n\n// return a percent-encoded representation of the specified byte range\n// @see http://en.wikipedia.org/wiki/Percent-encoding\nvar percentEncode = function(bytes, start, end) {\n var i, result = '';\n for (i = start; i < end; i++) {\n result += '%' + ('00' + bytes[i].toString(16)).slice(-2);\n }\n return result;\n};\n\n// return the string representation of the specified byte range,\n// interpreted as ISO-8859-1.\nvar parseIso88591 = function(bytes, start, end) {\n return unescape(percentEncode(bytes, start, end)); // jshint ignore:line\n};\n\nvar parseId3TagSize = function(header, byteIndex) {\n var\n returnSize = (header[byteIndex + 6] << 21) |\n (header[byteIndex + 7] << 14) |\n (header[byteIndex + 8] << 7) |\n (header[byteIndex + 9]),\n flags = header[byteIndex + 5],\n footerPresent = (flags & 16) >> 4;\n\n if (footerPresent) {\n return returnSize + 20;\n }\n return returnSize + 10;\n};\n\nvar parseAdtsSize = function(header, byteIndex) {\n var\n lowThree = (header[byteIndex + 5] & 0xE0) >> 5,\n middle = header[byteIndex + 4] << 3,\n highTwo = header[byteIndex + 3] & 0x3 << 11;\n\n return (highTwo | middle) | lowThree;\n};\n\nvar parseType = function(header, byteIndex) {\n if ((header[byteIndex] === 'I'.charCodeAt(0)) &&\n (header[byteIndex + 1] === 'D'.charCodeAt(0)) &&\n (header[byteIndex + 2] === '3'.charCodeAt(0))) {\n return 'timed-metadata';\n } else if ((header[byteIndex] & 0xff === 0xff) &&\n ((header[byteIndex + 1] & 0xf0) === 0xf0)) {\n return 'audio';\n }\n return null;\n};\n\nvar parseSampleRate = function(packet) {\n var i = 0;\n\n while (i + 5 < packet.length) {\n if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) {\n // If a valid header was not found, jump one forward and attempt to\n // find a valid ADTS header starting at the next byte\n i++;\n continue;\n }\n return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2];\n }\n\n return null;\n};\n\nvar parseAacTimestamp = function(packet) {\n var frameStart, frameSize, frame, frameHeader;\n\n // find the start of the first frame and the end of the tag\n frameStart = 10;\n if (packet[5] & 0x40) {\n // advance the frame start past the extended header\n frameStart += 4; // header size field\n frameStart += parseSyncSafeInteger(packet.subarray(10, 14));\n }\n\n // parse one or more ID3 frames\n // http://id3.org/id3v2.3.0#ID3v2_frame_overview\n do {\n // determine the number of bytes in this frame\n frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));\n if (frameSize < 1) {\n return null;\n }\n frameHeader = String.fromCharCode(packet[frameStart],\n packet[frameStart + 1],\n packet[frameStart + 2],\n packet[frameStart + 3]);\n\n if (frameHeader === 'PRIV') {\n frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);\n\n for (var i = 0; i < frame.byteLength; i++) {\n if (frame[i] === 0) {\n var owner = parseIso88591(frame, 0, i);\n if (owner === 'com.apple.streaming.transportStreamTimestamp') {\n var d = frame.subarray(i + 1);\n var size = ((d[3] & 0x01) << 30) |\n (d[4] << 22) |\n (d[5] << 14) |\n (d[6] << 6) |\n (d[7] >>> 2);\n size *= 4;\n size += d[7] & 0x03;\n\n return size;\n }\n break;\n }\n }\n }\n\n frameStart += 10; // advance past the frame header\n frameStart += frameSize; // advance past the frame body\n } while (frameStart < packet.byteLength);\n return null;\n};\n\nmodule.exports = {\n parseId3TagSize: parseId3TagSize,\n parseAdtsSize: parseAdtsSize,\n parseType: parseType,\n parseSampleRate: parseSampleRate,\n parseAacTimestamp: parseAacTimestamp\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/mux.js/lib/aac/probe.js\n// module id = 9ltH\n// module chunks = 0","/**\n * @file async-stream.js\n */\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar _stream = require('./stream');\n\nvar _stream2 = _interopRequireDefault(_stream);\n\n/**\n * A wrapper around the Stream class to use setTiemout\n * and run stream \"jobs\" Asynchronously\n *\n * @class AsyncStream\n * @extends Stream\n */\n\nvar AsyncStream = (function (_Stream) {\n _inherits(AsyncStream, _Stream);\n\n function AsyncStream() {\n _classCallCheck(this, AsyncStream);\n\n _get(Object.getPrototypeOf(AsyncStream.prototype), 'constructor', this).call(this, _stream2['default']);\n this.jobs = [];\n this.delay = 1;\n this.timeout_ = null;\n }\n\n /**\n * process an async job\n *\n * @private\n */\n\n _createClass(AsyncStream, [{\n key: 'processJob_',\n value: function processJob_() {\n this.jobs.shift()();\n if (this.jobs.length) {\n this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);\n } else {\n this.timeout_ = null;\n }\n }\n\n /**\n * push a job into the stream\n *\n * @param {Function} job the job to push into the stream\n */\n }, {\n key: 'push',\n value: function push(job) {\n this.jobs.push(job);\n if (!this.timeout_) {\n this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);\n }\n }\n }]);\n\n return AsyncStream;\n})(_stream2['default']);\n\nexports['default'] = AsyncStream;\nmodule.exports = exports['default'];\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/aes-decrypter/es5/async-stream.js\n// module id = A3vJ\n// module chunks = 0","'use strict';\n\nvar FlvTag = require('./flv-tag.js');\n\n// For information on the FLV format, see\n// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf.\n// Technically, this function returns the header and a metadata FLV tag\n// if duration is greater than zero\n// duration in seconds\n// @return {object} the bytes of the FLV header as a Uint8Array\nvar getFlvHeader = function(duration, audio, video) { // :ByteArray {\n var\n headBytes = new Uint8Array(3 + 1 + 1 + 4),\n head = new DataView(headBytes.buffer),\n metadata,\n result,\n metadataLength;\n\n // default arguments\n duration = duration || 0;\n audio = audio === undefined ? true : audio;\n video = video === undefined ? true : video;\n\n // signature\n head.setUint8(0, 0x46); // 'F'\n head.setUint8(1, 0x4c); // 'L'\n head.setUint8(2, 0x56); // 'V'\n\n // version\n head.setUint8(3, 0x01);\n\n // flags\n head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00));\n\n // data offset, should be 9 for FLV v1\n head.setUint32(5, headBytes.byteLength);\n\n // init the first FLV tag\n if (duration <= 0) {\n // no duration available so just write the first field of the first\n // FLV tag\n result = new Uint8Array(headBytes.byteLength + 4);\n result.set(headBytes);\n result.set([0, 0, 0, 0], headBytes.byteLength);\n return result;\n }\n\n // write out the duration metadata tag\n metadata = new FlvTag(FlvTag.METADATA_TAG);\n metadata.pts = metadata.dts = 0;\n metadata.writeMetaDataDouble('duration', duration);\n metadataLength = metadata.finalize().length;\n result = new Uint8Array(headBytes.byteLength + metadataLength);\n result.set(headBytes);\n result.set(head.byteLength, metadataLength);\n\n return result;\n};\n\nmodule.exports = getFlvHeader;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/mux.js/lib/flv/flv-header.js\n// module id = A9Em\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar _videoJs = require('video.js');\n\nvar _videoJs2 = _interopRequireDefault(_videoJs);\n\nvar defaultOptions = {\n errorInterval: 30,\n getSource: function getSource(next) {\n var tech = this.tech({ IWillNotUseThisInPlugins: true });\n var sourceObj = tech.currentSource_;\n\n return next(sourceObj);\n }\n};\n\n/**\n * Main entry point for the plugin\n *\n * @param {Player} player a reference to a videojs Player instance\n * @param {Object} [options] an object with plugin options\n * @private\n */\nvar initPlugin = function initPlugin(player, options) {\n var lastCalled = 0;\n var seekTo = 0;\n var localOptions = _videoJs2['default'].mergeOptions(defaultOptions, options);\n\n player.ready(function () {\n player.trigger({ type: 'usage', name: 'hls-error-reload-initialized' });\n });\n\n /**\n * Player modifications to perform that must wait until `loadedmetadata`\n * has been triggered\n *\n * @private\n */\n var loadedMetadataHandler = function loadedMetadataHandler() {\n if (seekTo) {\n player.currentTime(seekTo);\n }\n };\n\n /**\n * Set the source on the player element, play, and seek if necessary\n *\n * @param {Object} sourceObj An object specifying the source url and mime-type to play\n * @private\n */\n var setSource = function setSource(sourceObj) {\n if (sourceObj === null || sourceObj === undefined) {\n return;\n }\n seekTo = player.duration() !== Infinity && player.currentTime() || 0;\n\n player.one('loadedmetadata', loadedMetadataHandler);\n\n player.src(sourceObj);\n player.trigger({ type: 'usage', name: 'hls-error-reload' });\n player.play();\n };\n\n /**\n * Attempt to get a source from either the built-in getSource function\n * or a custom function provided via the options\n *\n * @private\n */\n var errorHandler = function errorHandler() {\n // Do not attempt to reload the source if a source-reload occurred before\n // 'errorInterval' time has elapsed since the last source-reload\n if (Date.now() - lastCalled < localOptions.errorInterval * 1000) {\n player.trigger({ type: 'usage', name: 'hls-error-reload-canceled' });\n return;\n }\n\n if (!localOptions.getSource || typeof localOptions.getSource !== 'function') {\n _videoJs2['default'].log.error('ERROR: reloadSourceOnError - The option getSource must be a function!');\n return;\n }\n lastCalled = Date.now();\n\n return localOptions.getSource.call(player, setSource);\n };\n\n /**\n * Unbind any event handlers that were bound by the plugin\n *\n * @private\n */\n var cleanupEvents = function cleanupEvents() {\n player.off('loadedmetadata', loadedMetadataHandler);\n player.off('error', errorHandler);\n player.off('dispose', cleanupEvents);\n };\n\n /**\n * Cleanup before re-initializing the plugin\n *\n * @param {Object} [newOptions] an object with plugin options\n * @private\n */\n var reinitPlugin = function reinitPlugin(newOptions) {\n cleanupEvents();\n initPlugin(player, newOptions);\n };\n\n player.on('error', errorHandler);\n player.on('dispose', cleanupEvents);\n\n // Overwrite the plugin function so that we can correctly cleanup before\n // initializing the plugin\n player.reloadSourceOnError = reinitPlugin;\n};\n\n/**\n * Reload the source when an error is detected as long as there\n * wasn't an error previously within the last 30 seconds\n *\n * @param {Object} [options] an object with plugin options\n */\nvar reloadSourceOnError = function reloadSourceOnError(options) {\n initPlugin(this, options);\n};\n\nexports['default'] = reloadSourceOnError;\nmodule.exports = exports['default'];\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/videojs-contrib-hls/es5/reload-source-on-error.js\n// module id = BZki\n// module chunks = 0","/**\n * @file xhr.js\n */\n\n/**\n * A wrapper for videojs.xhr that tracks bandwidth.\n *\n * @param {Object} options options for the XHR\n * @param {Function} callback the callback to call when done\n * @return {Request} the xhr request that is going to be made\n */\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar _videoJs = require('video.js');\n\nvar _videoJs2 = _interopRequireDefault(_videoJs);\n\nvar xhrFactory = function xhrFactory() {\n var xhr = function XhrFunction(options, callback) {\n // Add a default timeout for all hls requests\n options = (0, _videoJs.mergeOptions)({\n timeout: 45e3\n }, options);\n\n // Allow an optional user-specified function to modify the option\n // object before we construct the xhr request\n var beforeRequest = XhrFunction.beforeRequest || _videoJs2['default'].Hls.xhr.beforeRequest;\n\n if (beforeRequest && typeof beforeRequest === 'function') {\n var newOptions = beforeRequest(options);\n\n if (newOptions) {\n options = newOptions;\n }\n }\n\n var request = (0, _videoJs.xhr)(options, function (error, response) {\n var reqResponse = request.response;\n\n if (!error && reqResponse) {\n request.responseTime = Date.now();\n request.roundTripTime = request.responseTime - request.requestTime;\n request.bytesReceived = reqResponse.byteLength || reqResponse.length;\n if (!request.bandwidth) {\n request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000);\n }\n }\n\n // videojs.xhr now uses a specific code on the error\n // object to signal that a request has timed out instead\n // of setting a boolean on the request object\n if (error && error.code === 'ETIMEDOUT') {\n request.timedout = true;\n }\n\n // videojs.xhr no longer considers status codes outside of 200 and 0\n // (for file uris) to be errors, but the old XHR did, so emulate that\n // behavior. Status 206 may be used in response to byterange requests.\n if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {\n error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText)));\n }\n\n callback(error, request);\n });\n var originalAbort = request.abort;\n\n request.abort = function () {\n request.aborted = true;\n return originalAbort.apply(request, arguments);\n };\n request.uri = options.uri;\n request.requestTime = Date.now();\n return request;\n };\n\n return xhr;\n};\n\nexports['default'] = xhrFactory;\nmodule.exports = exports['default'];\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/videojs-contrib-hls/es5/xhr.js\n// module id = BiwK\n// module chunks = 0","/**\n * @file vtt-segment-loader.js\n */\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nvar _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar _segmentLoader = require('./segment-loader');\n\nvar _segmentLoader2 = _interopRequireDefault(_segmentLoader);\n\nvar _videoJs = require('video.js');\n\nvar _videoJs2 = _interopRequireDefault(_videoJs);\n\nvar _globalWindow = require('global/window');\n\nvar _globalWindow2 = _interopRequireDefault(_globalWindow);\n\nvar _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs = require('videojs-contrib-media-sources/es5/remove-cues-from-track.js');\n\nvar _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2 = _interopRequireDefault(_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs);\n\nvar _binUtils = require('./bin-utils');\n\nvar VTT_LINE_TERMINATORS = new Uint8Array('\\n\\n'.split('').map(function (char) {\n return char.charCodeAt(0);\n}));\n\nvar uintToString = function uintToString(uintArray) {\n return String.fromCharCode.apply(null, uintArray);\n};\n\n/**\n * An object that manages segment loading and appending.\n *\n * @class VTTSegmentLoader\n * @param {Object} options required and optional options\n * @extends videojs.EventTarget\n */\n\nvar VTTSegmentLoader = (function (_SegmentLoader) {\n _inherits(VTTSegmentLoader, _SegmentLoader);\n\n function VTTSegmentLoader(settings) {\n var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n _classCallCheck(this, VTTSegmentLoader);\n\n _get(Object.getPrototypeOf(VTTSegmentLoader.prototype), 'constructor', this).call(this, settings, options);\n\n // SegmentLoader requires a MediaSource be specified or it will throw an error;\n // however, VTTSegmentLoader has no need of a media source, so delete the reference\n this.mediaSource_ = null;\n\n this.subtitlesTrack_ = null;\n }\n\n /**\n * Indicates which time ranges are buffered\n *\n * @return {TimeRange}\n * TimeRange object representing the current buffered ranges\n */\n\n _createClass(VTTSegmentLoader, [{\n key: 'buffered_',\n value: function buffered_() {\n if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues.length) {\n return _videoJs2['default'].createTimeRanges();\n }\n\n var cues = this.subtitlesTrack_.cues;\n var start = cues[0].startTime;\n var end = cues[cues.length - 1].startTime;\n\n return _videoJs2['default'].createTimeRanges([[start, end]]);\n }\n\n /**\n * Gets and sets init segment for the provided map\n *\n * @param {Object} map\n * The map object representing the init segment to get or set\n * @param {Boolean=} set\n * If true, the init segment for the provided map should be saved\n * @return {Object}\n * map object for desired init segment\n */\n }, {\n key: 'initSegment',\n value: function initSegment(map) {\n var set = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n\n if (!map) {\n return null;\n }\n\n var id = (0, _binUtils.initSegmentId)(map);\n var storedMap = this.initSegments_[id];\n\n if (set && !storedMap && map.bytes) {\n // append WebVTT line terminators to the media initialization segment if it exists\n // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that\n // requires two or more WebVTT line terminators between the WebVTT header and the\n // rest of the file\n var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength;\n var combinedSegment = new Uint8Array(combinedByteLength);\n\n combinedSegment.set(map.bytes);\n combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength);\n\n this.initSegments_[id] = storedMap = {\n resolvedUri: map.resolvedUri,\n byterange: map.byterange,\n bytes: combinedSegment\n };\n }\n\n return storedMap || map;\n }\n\n /**\n * Returns true if all configuration required for loading is present, otherwise false.\n *\n * @return {Boolean} True if the all configuration is ready for loading\n * @private\n */\n }, {\n key: 'couldBeginLoading_',\n value: function couldBeginLoading_() {\n return this.playlist_ && this.subtitlesTrack_ && !this.paused();\n }\n\n /**\n * Once all the starting parameters have been specified, begin\n * operation. This method should only be invoked from the INIT\n * state.\n *\n * @private\n */\n }, {\n key: 'init_',\n value: function init_() {\n this.state = 'READY';\n this.resetEverything();\n return this.monitorBuffer_();\n }\n\n /**\n * Set a subtitle track on the segment loader to add subtitles to\n *\n * @param {TextTrack=} track\n * The text track to add loaded subtitles to\n * @return {TextTrack}\n * Returns the subtitles track\n */\n }, {\n key: 'track',\n value: function track(_track) {\n if (typeof _track === 'undefined') {\n return this.subtitlesTrack_;\n }\n\n this.subtitlesTrack_ = _track;\n\n // if we were unpaused but waiting for a sourceUpdater, start\n // buffering now\n if (this.state === 'INIT' && this.couldBeginLoading_()) {\n this.init_();\n }\n\n return this.subtitlesTrack_;\n }\n\n /**\n * Remove any data in the source buffer between start and end times\n * @param {Number} start - the start time of the region to remove from the buffer\n * @param {Number} end - the end time of the region to remove from the buffer\n */\n }, {\n key: 'remove',\n value: function remove(start, end) {\n (0, _videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2['default'])(start, end, this.subtitlesTrack_);\n }\n\n /**\n * fill the buffer with segements unless the sourceBuffers are\n * currently updating\n *\n * Note: this function should only ever be called by monitorBuffer_\n * and never directly\n *\n * @private\n */\n }, {\n key: 'fillBuffer_',\n value: function fillBuffer_() {\n var _this = this;\n\n if (!this.syncPoint_) {\n this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());\n }\n\n // see if we need to begin loading immediately\n var segmentInfo = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this.hasPlayed_(), this.currentTime_(), this.syncPoint_);\n\n segmentInfo = this.skipEmptySegments_(segmentInfo);\n\n if (!segmentInfo) {\n return;\n }\n\n if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {\n // We don't have the timestamp offset that we need to sync subtitles.\n // Rerun on a timestamp offset or user interaction.\n var checkTimestampOffset = function checkTimestampOffset() {\n _this.state = 'READY';\n if (!_this.paused()) {\n // if not paused, queue a buffer check as soon as possible\n _this.monitorBuffer_();\n }\n };\n\n this.syncController_.one('timestampoffset', checkTimestampOffset);\n this.state = 'WAITING_ON_TIMELINE';\n return;\n }\n\n this.loadSegment_(segmentInfo);\n }\n\n /**\n * Prevents the segment loader from requesting segments we know contain no subtitles\n * by walking forward until we find the next segment that we don't know whether it is\n * empty or not.\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @return {Object}\n * a segment info object that describes the current segment\n */\n }, {\n key: 'skipEmptySegments_',\n value: function skipEmptySegments_(segmentInfo) {\n while (segmentInfo && segmentInfo.segment.empty) {\n segmentInfo = this.generateSegmentInfo_(segmentInfo.playlist, segmentInfo.mediaIndex + 1, segmentInfo.startOfSegment + segmentInfo.duration, segmentInfo.isSyncRequest);\n }\n return segmentInfo;\n }\n\n /**\n * append a decrypted segement to the SourceBuffer through a SourceUpdater\n *\n * @private\n */\n }, {\n key: 'handleSegment_',\n value: function handleSegment_() {\n var _this2 = this;\n\n if (!this.pendingSegment_ || !this.subtitlesTrack_) {\n this.state = 'READY';\n return;\n }\n\n this.state = 'APPENDING';\n\n var segmentInfo = this.pendingSegment_;\n var segment = segmentInfo.segment;\n\n // Make sure that vttjs has loaded, otherwise, wait till it finished loading\n if (typeof _globalWindow2['default'].WebVTT !== 'function' && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) {\n var _ret = (function () {\n\n var loadHandler = function loadHandler() {\n _this2.handleSegment_();\n };\n\n _this2.state = 'WAITING_ON_VTTJS';\n _this2.subtitlesTrack_.tech_.one('vttjsloaded', loadHandler);\n _this2.subtitlesTrack_.tech_.one('vttjserror', function () {\n _this2.subtitlesTrack_.tech_.off('vttjsloaded', loadHandler);\n _this2.error({\n message: 'Error loading vtt.js'\n });\n _this2.state = 'READY';\n _this2.pause();\n _this2.trigger('error');\n });\n\n return {\n v: undefined\n };\n })();\n\n if (typeof _ret === 'object') return _ret.v;\n }\n\n segment.requested = true;\n\n try {\n this.parseVTTCues_(segmentInfo);\n } catch (e) {\n this.error({\n message: e.message\n });\n this.state = 'READY';\n this.pause();\n return this.trigger('error');\n }\n\n this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);\n\n if (segmentInfo.isSyncRequest) {\n this.trigger('syncinfoupdate');\n this.pendingSegment_ = null;\n this.state = 'READY';\n return;\n }\n\n segmentInfo.byteLength = segmentInfo.bytes.byteLength;\n\n this.mediaSecondsLoaded += segment.duration;\n\n if (segmentInfo.cues.length) {\n // remove any overlapping cues to prevent doubling\n this.remove(segmentInfo.cues[0].endTime, segmentInfo.cues[segmentInfo.cues.length - 1].endTime);\n }\n\n segmentInfo.cues.forEach(function (cue) {\n _this2.subtitlesTrack_.addCue(cue);\n });\n\n this.handleUpdateEnd_();\n }\n\n /**\n * Uses the WebVTT parser to parse the segment response\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @private\n */\n }, {\n key: 'parseVTTCues_',\n value: function parseVTTCues_(segmentInfo) {\n var decoder = undefined;\n var decodeBytesToString = false;\n\n if (typeof _globalWindow2['default'].TextDecoder === 'function') {\n decoder = new _globalWindow2['default'].TextDecoder('utf8');\n } else {\n decoder = _globalWindow2['default'].WebVTT.StringDecoder();\n decodeBytesToString = true;\n }\n\n var parser = new _globalWindow2['default'].WebVTT.Parser(_globalWindow2['default'], _globalWindow2['default'].vttjs, decoder);\n\n segmentInfo.cues = [];\n segmentInfo.timestampmap = { MPEGTS: 0, LOCAL: 0 };\n\n parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);\n parser.ontimestampmap = function (map) {\n return segmentInfo.timestampmap = map;\n };\n parser.onparsingerror = function (error) {\n _videoJs2['default'].log.warn('Error encountered when parsing cues: ' + error.message);\n };\n\n if (segmentInfo.segment.map) {\n var mapData = segmentInfo.segment.map.bytes;\n\n if (decodeBytesToString) {\n mapData = uintToString(mapData);\n }\n\n parser.parse(mapData);\n }\n\n var segmentData = segmentInfo.bytes;\n\n if (decodeBytesToString) {\n segmentData = uintToString(segmentData);\n }\n\n parser.parse(segmentData);\n parser.flush();\n }\n\n /**\n * Updates the start and end times of any cues parsed by the WebVTT parser using\n * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping\n * from the SyncController\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @param {Object} mappingObj\n * object containing a mapping from TS to media time\n * @param {Object} playlist\n * the playlist object containing the segment\n * @private\n */\n }, {\n key: 'updateTimeMapping_',\n value: function updateTimeMapping_(segmentInfo, mappingObj, playlist) {\n var segment = segmentInfo.segment;\n\n if (!mappingObj) {\n // If the sync controller does not have a mapping of TS to Media Time for the\n // timeline, then we don't have enough information to update the cue\n // start/end times\n return;\n }\n\n if (!segmentInfo.cues.length) {\n // If there are no cues, we also do not have enough information to figure out\n // segment timing. Mark that the segment contains no cues so we don't re-request\n // an empty segment.\n segment.empty = true;\n return;\n }\n\n var timestampmap = segmentInfo.timestampmap;\n var diff = timestampmap.MPEGTS / 90000 - timestampmap.LOCAL + mappingObj.mapping;\n\n segmentInfo.cues.forEach(function (cue) {\n // First convert cue time to TS time using the timestamp-map provided within the vtt\n cue.startTime += diff;\n cue.endTime += diff;\n });\n\n if (!playlist.syncInfo) {\n var firstStart = segmentInfo.cues[0].startTime;\n var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;\n\n playlist.syncInfo = {\n mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,\n time: Math.min(firstStart, lastStart - segment.duration)\n };\n }\n }\n }]);\n\n return VTTSegmentLoader;\n})(_segmentLoader2['default']);\n\nexports['default'] = VTTSegmentLoader;\nmodule.exports = exports['default'];\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/videojs-contrib-hls/es5/vtt-segment-loader.js\n// module id = CD7c\n// module chunks = 0","/*\n * pkcs7.pad\n * https://github.com/brightcove/pkcs7\n *\n * Copyright (c) 2014 Brightcove\n * Licensed under the apache2 license.\n */\n\n'use strict';\n\nvar PADDING;\n\n/**\n * Returns a new Uint8Array that is padded with PKCS#7 padding.\n * @param plaintext {Uint8Array} the input bytes before encryption\n * @return {Uint8Array} the padded bytes\n * @see http://tools.ietf.org/html/rfc5652\n */\nmodule.exports = function pad(plaintext) {\n var padding = PADDING[(plaintext.byteLength % 16) || 0],\n result = new Uint8Array(plaintext.byteLength + padding.length);\n result.set(plaintext);\n result.set(padding, plaintext.byteLength);\n return result;\n};\n\n// pre-define the padding values\nPADDING = [\n [16, 16, 16, 16,\n 16, 16, 16, 16,\n 16, 16, 16, 16,\n 16, 16, 16, 16],\n\n [15, 15, 15, 15,\n 15, 15, 15, 15,\n 15, 15, 15, 15,\n 15, 15, 15],\n\n [14, 14, 14, 14,\n 14, 14, 14, 14,\n 14, 14, 14, 14,\n 14, 14],\n\n [13, 13, 13, 13,\n 13, 13, 13, 13,\n 13, 13, 13, 13,\n 13],\n\n [12, 12, 12, 12,\n 12, 12, 12, 12,\n 12, 12, 12, 12],\n\n [11, 11, 11, 11,\n 11, 11, 11, 11,\n 11, 11, 11],\n\n [10, 10, 10, 10,\n 10, 10, 10, 10,\n 10, 10],\n\n [9, 9, 9, 9,\n 9, 9, 9, 9,\n 9],\n\n [8, 8, 8, 8,\n 8, 8, 8, 8],\n\n [7, 7, 7, 7,\n 7, 7, 7],\n\n [6, 6, 6, 6,\n 6, 6],\n\n [5, 5, 5, 5,\n 5],\n\n [4, 4, 4, 4],\n\n [3, 3, 3],\n\n [2, 2],\n\n [1]\n];\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/pkcs7/lib/pad.js\n// module id = CDvG\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _stream = require('./stream');\n\nvar _stream2 = _interopRequireDefault(_stream);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n * @file m3u8/parse-stream.js\n */\n\n\n/**\n * \"forgiving\" attribute list psuedo-grammar:\n * attributes -> keyvalue (',' keyvalue)*\n * keyvalue -> key '=' value\n * key -> [^=]*\n * value -> '\"' [^\"]* '\"' | [^,]*\n */\nvar attributeSeparator = function attributeSeparator() {\n var key = '[^=]*';\n var value = '\"[^\"]*\"|[^,]*';\n var keyvalue = '(?:' + key + ')=(?:' + value + ')';\n\n return new RegExp('(?:^|,)(' + keyvalue + ')');\n};\n\n/**\n * Parse attributes from a line given the seperator\n *\n * @param {String} attributes the attibute line to parse\n */\nvar parseAttributes = function parseAttributes(attributes) {\n // split the string using attributes as the separator\n var attrs = attributes.split(attributeSeparator());\n var result = {};\n var i = attrs.length;\n var attr = void 0;\n\n while (i--) {\n // filter out unmatched portions of the string\n if (attrs[i] === '') {\n continue;\n }\n\n // split the key and value\n attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1);\n // trim whitespace and remove optional quotes around the value\n attr[0] = attr[0].replace(/^\\s+|\\s+$/g, '');\n attr[1] = attr[1].replace(/^\\s+|\\s+$/g, '');\n attr[1] = attr[1].replace(/^['\"](.*)['\"]$/g, '$1');\n result[attr[0]] = attr[1];\n }\n return result;\n};\n\n/**\n * A line-level M3U8 parser event stream. It expects to receive input one\n * line at a time and performs a context-free parse of its contents. A stream\n * interpretation of a manifest can be useful if the manifest is expected to\n * be too large to fit comfortably into memory or the entirety of the input\n * is not immediately available. Otherwise, it's probably much easier to work\n * with a regular `Parser` object.\n *\n * Produces `data` events with an object that captures the parser's\n * interpretation of the input. That object has a property `tag` that is one\n * of `uri`, `comment`, or `tag`. URIs only have a single additional\n * property, `line`, which captures the entirety of the input without\n * interpretation. Comments similarly have a single additional property\n * `text` which is the input without the leading `#`.\n *\n * Tags always have a property `tagType` which is the lower-cased version of\n * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance,\n * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized\n * tags are given the tag type `unknown` and a single additional property\n * `data` with the remainder of the input.\n *\n * @class ParseStream\n * @extends Stream\n */\n\nvar ParseStream = function (_Stream) {\n _inherits(ParseStream, _Stream);\n\n function ParseStream() {\n _classCallCheck(this, ParseStream);\n\n return _possibleConstructorReturn(this, (ParseStream.__proto__ || Object.getPrototypeOf(ParseStream)).call(this));\n }\n\n /**\n * Parses an additional line of input.\n *\n * @param {String} line a single line of an M3U8 file to parse\n */\n\n\n _createClass(ParseStream, [{\n key: 'push',\n value: function push(line) {\n var match = void 0;\n var event = void 0;\n\n // strip whitespace\n line = line.replace(/^[\\u0000\\s]+|[\\u0000\\s]+$/g, '');\n if (line.length === 0) {\n // ignore empty lines\n return;\n }\n\n // URIs\n if (line[0] !== '#') {\n this.trigger('data', {\n type: 'uri',\n uri: line\n });\n return;\n }\n\n // Comments\n if (line.indexOf('#EXT') !== 0) {\n this.trigger('data', {\n type: 'comment',\n text: line.slice(1)\n });\n return;\n }\n\n // strip off any carriage returns here so the regex matching\n // doesn't have to account for them.\n line = line.replace('\\r', '');\n\n // Tags\n match = /^#EXTM3U/.exec(line);\n if (match) {\n this.trigger('data', {\n type: 'tag',\n tagType: 'm3u'\n });\n return;\n }\n match = /^#EXTINF:?([0-9\\.]*)?,?(.*)?$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'inf'\n };\n if (match[1]) {\n event.duration = parseFloat(match[1]);\n }\n if (match[2]) {\n event.title = match[2];\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'targetduration'\n };\n if (match[1]) {\n event.duration = parseInt(match[1], 10);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'totalduration'\n };\n if (match[1]) {\n event.duration = parseInt(match[1], 10);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'version'\n };\n if (match[1]) {\n event.version = parseInt(match[1], 10);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-MEDIA-SEQUENCE:?(\\-?[0-9.]*)?/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'media-sequence'\n };\n if (match[1]) {\n event.number = parseInt(match[1], 10);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\\-?[0-9.]*)?/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'discontinuity-sequence'\n };\n if (match[1]) {\n event.number = parseInt(match[1], 10);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'playlist-type'\n };\n if (match[1]) {\n event.playlistType = match[1];\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'byterange'\n };\n if (match[1]) {\n event.length = parseInt(match[1], 10);\n }\n if (match[2]) {\n event.offset = parseInt(match[2], 10);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'allow-cache'\n };\n if (match[1]) {\n event.allowed = !/NO/.test(match[1]);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-MAP:?(.*)$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'map'\n };\n\n if (match[1]) {\n var attributes = parseAttributes(match[1]);\n\n if (attributes.URI) {\n event.uri = attributes.URI;\n }\n if (attributes.BYTERANGE) {\n var _attributes$BYTERANGE = attributes.BYTERANGE.split('@'),\n _attributes$BYTERANGE2 = _slicedToArray(_attributes$BYTERANGE, 2),\n length = _attributes$BYTERANGE2[0],\n offset = _attributes$BYTERANGE2[1];\n\n event.byterange = {};\n if (length) {\n event.byterange.length = parseInt(length, 10);\n }\n if (offset) {\n event.byterange.offset = parseInt(offset, 10);\n }\n }\n }\n\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'stream-inf'\n };\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n\n if (event.attributes.RESOLUTION) {\n var split = event.attributes.RESOLUTION.split('x');\n var resolution = {};\n\n if (split[0]) {\n resolution.width = parseInt(split[0], 10);\n }\n if (split[1]) {\n resolution.height = parseInt(split[1], 10);\n }\n event.attributes.RESOLUTION = resolution;\n }\n if (event.attributes.BANDWIDTH) {\n event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10);\n }\n if (event.attributes['PROGRAM-ID']) {\n event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10);\n }\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-MEDIA:?(.*)$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'media'\n };\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-ENDLIST/.exec(line);\n if (match) {\n this.trigger('data', {\n type: 'tag',\n tagType: 'endlist'\n });\n return;\n }\n match = /^#EXT-X-DISCONTINUITY/.exec(line);\n if (match) {\n this.trigger('data', {\n type: 'tag',\n tagType: 'discontinuity'\n });\n return;\n }\n match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'program-date-time'\n };\n if (match[1]) {\n event.dateTimeString = match[1];\n event.dateTimeObject = new Date(match[1]);\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-KEY:?(.*)$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'key'\n };\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n // parse the IV string into a Uint32Array\n if (event.attributes.IV) {\n if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') {\n event.attributes.IV = event.attributes.IV.substring(2);\n }\n\n event.attributes.IV = event.attributes.IV.match(/.{8}/g);\n event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16);\n event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16);\n event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16);\n event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16);\n event.attributes.IV = new Uint32Array(event.attributes.IV);\n }\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-out-cont'\n };\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-out'\n };\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n this.trigger('data', event);\n return;\n }\n match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(line);\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-in'\n };\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n this.trigger('data', event);\n return;\n }\n\n // unknown tag type\n this.trigger('data', {\n type: 'tag',\n data: line.slice(4)\n });\n }\n }]);\n\n return ParseStream;\n}(_stream2['default']);\n\nexports['default'] = ParseStream;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/m3u8-parser/es5/parse-stream.js\n// module id = DTJQ\n// module chunks = 0","/**\n * @license\n * Video.js 6.13.0
\n * Copyright Brightcove, Inc.
\n * Available under Apache License Version 2.0\n *
\n *\n * Includes vtt.js \n * Available under Apache License Version 2.0\n * \n */\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nvar window = _interopDefault(require('global/window'));\nvar document = _interopDefault(require('global/document'));\nvar tsml = _interopDefault(require('tsml'));\nvar safeParseTuple = _interopDefault(require('safe-json-parse/tuple'));\nvar xhr = _interopDefault(require('xhr'));\nvar vtt = _interopDefault(require('videojs-vtt.js'));\n\nvar version = \"6.13.0\";\n\n/**\n * @file browser.js\n * @module browser\n */\nvar USER_AGENT = window.navigator && window.navigator.userAgent || '';\nvar webkitVersionMap = /AppleWebKit\\/([\\d.]+)/i.exec(USER_AGENT);\nvar appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;\n\n/*\n * Device is an iPhone\n *\n * @type {Boolean}\n * @constant\n * @private\n */\nvar IS_IPAD = /iPad/i.test(USER_AGENT);\n\n// The Facebook app's UIWebView identifies as both an iPhone and iPad, so\n// to identify iPhones, we need to exclude iPads.\n// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/\nvar IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;\nvar IS_IPOD = /iPod/i.test(USER_AGENT);\nvar IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;\n\nvar IOS_VERSION = function () {\n var match = USER_AGENT.match(/OS (\\d+)_/i);\n\n if (match && match[1]) {\n return match[1];\n }\n return null;\n}();\n\nvar IS_ANDROID = /Android/i.test(USER_AGENT);\nvar ANDROID_VERSION = function () {\n // This matches Android Major.Minor.Patch versions\n // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned\n var match = USER_AGENT.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);\n\n if (!match) {\n return null;\n }\n\n var major = match[1] && parseFloat(match[1]);\n var minor = match[2] && parseFloat(match[2]);\n\n if (major && minor) {\n return parseFloat(match[1] + '.' + match[2]);\n } else if (major) {\n return major;\n }\n return null;\n}();\n\n// Old Android is defined as Version older than 2.3, and requiring a webkit version of the android browser\nvar IS_OLD_ANDROID = IS_ANDROID && /webkit/i.test(USER_AGENT) && ANDROID_VERSION < 2.3;\nvar IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;\n\nvar IS_FIREFOX = /Firefox/i.test(USER_AGENT);\nvar IS_EDGE = /Edge/i.test(USER_AGENT);\nvar IS_CHROME = !IS_EDGE && (/Chrome/i.test(USER_AGENT) || /CriOS/i.test(USER_AGENT));\nvar CHROME_VERSION = function () {\n var match = USER_AGENT.match(/(Chrome|CriOS)\\/(\\d+)/);\n\n if (match && match[2]) {\n return parseFloat(match[2]);\n }\n return null;\n}();\nvar IS_IE8 = /MSIE\\s8\\.0/.test(USER_AGENT);\nvar IE_VERSION = function () {\n var result = /MSIE\\s(\\d+)\\.\\d/.exec(USER_AGENT);\n var version = result && parseFloat(result[1]);\n\n if (!version && /Trident\\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {\n // IE 11 has a different user agent string than other IE versions\n version = 11.0;\n }\n\n return version;\n}();\n\nvar IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;\nvar IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;\n\nvar TOUCH_ENABLED = isReal() && ('ontouchstart' in window || window.navigator.maxTouchPoints || window.DocumentTouch && window.document instanceof window.DocumentTouch);\n\nvar BACKGROUND_SIZE_SUPPORTED = isReal() && 'backgroundSize' in window.document.createElement('video').style;\n\nvar browser = (Object.freeze || Object)({\n\tIS_IPAD: IS_IPAD,\n\tIS_IPHONE: IS_IPHONE,\n\tIS_IPOD: IS_IPOD,\n\tIS_IOS: IS_IOS,\n\tIOS_VERSION: IOS_VERSION,\n\tIS_ANDROID: IS_ANDROID,\n\tANDROID_VERSION: ANDROID_VERSION,\n\tIS_OLD_ANDROID: IS_OLD_ANDROID,\n\tIS_NATIVE_ANDROID: IS_NATIVE_ANDROID,\n\tIS_FIREFOX: IS_FIREFOX,\n\tIS_EDGE: IS_EDGE,\n\tIS_CHROME: IS_CHROME,\n\tCHROME_VERSION: CHROME_VERSION,\n\tIS_IE8: IS_IE8,\n\tIE_VERSION: IE_VERSION,\n\tIS_SAFARI: IS_SAFARI,\n\tIS_ANY_SAFARI: IS_ANY_SAFARI,\n\tTOUCH_ENABLED: TOUCH_ENABLED,\n\tBACKGROUND_SIZE_SUPPORTED: BACKGROUND_SIZE_SUPPORTED\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n};\n\n\n\n\n\n\n\n\n\n\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\n\n\n\n\n\n\n\n\n\n\nvar inherits = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\n\n\n\n\n\n\n\n\n\n\nvar possibleConstructorReturn = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\n\n\n\n\n\n\n\n\n\n\nvar taggedTemplateLiteralLoose = function (strings, raw) {\n strings.raw = raw;\n return strings;\n};\n\n/**\n * @file obj.js\n * @module obj\n */\n\n/**\n * @callback obj:EachCallback\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n */\n\n/**\n * @callback obj:ReduceCallback\n *\n * @param {Mixed} accum\n * The value that is accumulating over the reduce loop.\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n *\n * @return {Mixed}\n * The new accumulated value.\n */\nvar toString = Object.prototype.toString;\n\n/**\n * Get the keys of an Object\n *\n * @param {Object}\n * The Object to get the keys from\n *\n * @return {string[]}\n * An array of the keys from the object. Returns an empty array if the\n * object passed in was invalid or had no keys.\n *\n * @private\n */\nvar keys = function keys(object) {\n return isObject(object) ? Object.keys(object) : [];\n};\n\n/**\n * Array-like iteration for objects.\n *\n * @param {Object} object\n * The object to iterate over\n *\n * @param {obj:EachCallback} fn\n * The callback function which is called for each key in the object.\n */\nfunction each(object, fn) {\n keys(object).forEach(function (key) {\n return fn(object[key], key);\n });\n}\n\n/**\n * Array-like reduce for objects.\n *\n * @param {Object} object\n * The Object that you want to reduce.\n *\n * @param {Function} fn\n * A callback function which is called for each key in the object. It\n * receives the accumulated value and the per-iteration value and key\n * as arguments.\n *\n * @param {Mixed} [initial = 0]\n * Starting value\n *\n * @return {Mixed}\n * The final accumulated value.\n */\nfunction reduce(object, fn) {\n var initial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n\n return keys(object).reduce(function (accum, key) {\n return fn(accum, object[key], key);\n }, initial);\n}\n\n/**\n * Object.assign-style object shallow merge/extend.\n *\n * @param {Object} target\n * @param {Object} ...sources\n * @return {Object}\n */\nfunction assign(target) {\n for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n sources[_key - 1] = arguments[_key];\n }\n\n if (Object.assign) {\n return Object.assign.apply(Object, [target].concat(sources));\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n each(source, function (value, key) {\n target[key] = value;\n });\n });\n\n return target;\n}\n\n/**\n * Returns whether a value is an object of any kind - including DOM nodes,\n * arrays, regular expressions, etc. Not functions, though.\n *\n * This avoids the gotcha where using `typeof` on a `null` value\n * results in `'object'`.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nfunction isObject(value) {\n return !!value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object';\n}\n\n/**\n * Returns whether an object appears to be a \"plain\" object - that is, a\n * direct instance of `Object`.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nfunction isPlain(value) {\n return isObject(value) && toString.call(value) === '[object Object]' && value.constructor === Object;\n}\n\n/**\n * @file create-logger.js\n * @module create-logger\n */\n// This is the private tracking variable for the logging history.\nvar history = [];\n\n/**\n * Log messages to the console and history based on the type of message\n *\n * @private\n * @param {string} type\n * The name of the console method to use.\n *\n * @param {Array} args\n * The arguments to be passed to the matching console method.\n */\nvar LogByTypeFactory = function LogByTypeFactory(name, log) {\n return function (type, level, args, stringify) {\n var lvl = log.levels[level];\n var lvlRegExp = new RegExp('^(' + lvl + ')$');\n\n if (type !== 'log') {\n\n // Add the type to the front of the message when it's not \"log\".\n args.unshift(type.toUpperCase() + ':');\n }\n\n // Add console prefix after adding to history.\n args.unshift(name + ':');\n\n // Add a clone of the args at this point to history.\n if (history) {\n history.push([].concat(args));\n }\n\n // If there's no console then don't try to output messages, but they will\n // still be stored in history.\n if (!window.console) {\n return;\n }\n\n // Was setting these once outside of this function, but containing them\n // in the function makes it easier to test cases where console doesn't exist\n // when the module is executed.\n var fn = window.console[type];\n\n if (!fn && type === 'debug') {\n // Certain browsers don't have support for console.debug. For those, we\n // should default to the closest comparable log.\n fn = window.console.info || window.console.log;\n }\n\n // Bail out if there's no console or if this type is not allowed by the\n // current logging level.\n if (!fn || !lvl || !lvlRegExp.test(type)) {\n return;\n }\n\n // IEs previous to 11 log objects uselessly as \"[object Object]\"; so, JSONify\n // objects and arrays for those less-capable browsers.\n if (stringify) {\n args = args.map(function (a) {\n if (isObject(a) || Array.isArray(a)) {\n try {\n return JSON.stringify(a);\n } catch (x) {\n return String(a);\n }\n }\n\n // Cast to string before joining, so we get null and undefined explicitly\n // included in output (as we would in a modern console).\n return String(a);\n }).join(' ');\n }\n\n // Old IE versions do not allow .apply() for console methods (they are\n // reported as objects rather than functions).\n if (!fn.apply) {\n fn(args);\n } else {\n fn[Array.isArray(args) ? 'apply' : 'call'](window.console, args);\n }\n };\n};\n\nfunction createLogger$1(name) {\n // This is the private tracking variable for logging level.\n var level = 'info';\n\n // the curried logByType bound to the specific log and history\n var logByType = void 0;\n\n /**\n * Logs plain debug messages. Similar to `console.log`.\n *\n * Due to [limitations](https://github.com/jsdoc3/jsdoc/issues/955#issuecomment-313829149)\n * of our JSDoc template, we cannot properly document this as both a function\n * and a namespace, so its function signature is documented here.\n *\n * #### Arguments\n * ##### *args\n * Mixed[]\n *\n * Any combination of values that could be passed to `console.log()`.\n *\n * #### Return Value\n *\n * `undefined`\n *\n * @namespace\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged.\n */\n var log = function log() {\n var stringify = log.stringify || IE_VERSION && IE_VERSION < 11;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n logByType('log', level, args, stringify);\n };\n\n // This is the logByType helper that the logging methods below use\n logByType = LogByTypeFactory(name, log);\n\n /**\n * Create a new sublogger which chains the old name to the new name.\n *\n * For example, doing `videojs.log.createLogger('player')` and then using that logger will log the following:\n * ```js\n * mylogger('foo');\n * // > VIDEOJS: player: foo\n * ```\n *\n * @param {string} name\n * The name to add call the new logger\n * @return {Object}\n */\n log.createLogger = function (subname) {\n return createLogger$1(name + ': ' + subname);\n };\n\n /**\n * Enumeration of available logging levels, where the keys are the level names\n * and the values are `|`-separated strings containing logging methods allowed\n * in that logging level. These strings are used to create a regular expression\n * matching the function name being called.\n *\n * Levels provided by Video.js are:\n *\n * - `off`: Matches no calls. Any value that can be cast to `false` will have\n * this effect. The most restrictive.\n * - `all`: Matches only Video.js-provided functions (`debug`, `log`,\n * `log.warn`, and `log.error`).\n * - `debug`: Matches `log.debug`, `log`, `log.warn`, and `log.error` calls.\n * - `info` (default): Matches `log`, `log.warn`, and `log.error` calls.\n * - `warn`: Matches `log.warn` and `log.error` calls.\n * - `error`: Matches only `log.error` calls.\n *\n * @type {Object}\n */\n log.levels = {\n all: 'debug|log|warn|error',\n off: '',\n debug: 'debug|log|warn|error',\n info: 'log|warn|error',\n warn: 'warn|error',\n error: 'error',\n DEFAULT: level\n };\n\n /**\n * Get or set the current logging level.\n *\n * If a string matching a key from {@link module:log.levels} is provided, acts\n * as a setter.\n *\n * @param {string} [lvl]\n * Pass a valid level to set a new logging level.\n *\n * @return {string}\n * The current logging level.\n */\n log.level = function (lvl) {\n if (typeof lvl === 'string') {\n if (!log.levels.hasOwnProperty(lvl)) {\n throw new Error('\"' + lvl + '\" in not a valid log level');\n }\n level = lvl;\n }\n return level;\n };\n\n /**\n * Returns an array containing everything that has been logged to the history.\n *\n * This array is a shallow clone of the internal history record. However, its\n * contents are _not_ cloned; so, mutating objects inside this array will\n * mutate them in history.\n *\n * @return {Array}\n */\n log.history = function () {\n return history ? [].concat(history) : [];\n };\n\n /**\n * Allows you to filter the history by the given logger name\n *\n * @param {string} fname\n * The name to filter by\n *\n * @return {Array}\n * The filtered list to return\n */\n log.history.filter = function (fname) {\n return (history || []).filter(function (historyItem) {\n // if the first item in each historyItem includes `fname`, then it's a match\n return new RegExp('.*' + fname + '.*').test(historyItem[0]);\n });\n };\n\n /**\n * Clears the internal history tracking, but does not prevent further history\n * tracking.\n */\n log.history.clear = function () {\n if (history) {\n history.length = 0;\n }\n };\n\n /**\n * Disable history tracking if it is currently enabled.\n */\n log.history.disable = function () {\n if (history !== null) {\n history.length = 0;\n history = null;\n }\n };\n\n /**\n * Enable history tracking if it is currently disabled.\n */\n log.history.enable = function () {\n if (history === null) {\n history = [];\n }\n };\n\n /**\n * Logs error messages. Similar to `console.error`.\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as an error\n */\n log.error = function () {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return logByType('error', level, args);\n };\n\n /**\n * Logs warning messages. Similar to `console.warn`.\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as a warning.\n */\n log.warn = function () {\n for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return logByType('warn', level, args);\n };\n\n /**\n * Logs debug messages. Similar to `console.debug`, but may also act as a comparable\n * log if `console.debug` is not available\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as debug.\n */\n log.debug = function () {\n for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return logByType('debug', level, args);\n };\n\n return log;\n}\n\n/**\n * @file log.js\n * @module log\n */\nvar log = createLogger$1('VIDEOJS');\nvar createLogger = log.createLogger;\n\n/**\n * @file computed-style.js\n * @module computed-style\n */\n/**\n * A safe getComputedStyle with an IE8 fallback.\n *\n * This is needed because in Firefox, if the player is loaded in an iframe with\n * `display:none`, then `getComputedStyle` returns `null`, so, we do a null-check to\n * make sure that the player doesn't break in these cases.\n *\n * @param {Element} el\n * The element you want the computed style of\n *\n * @param {string} prop\n * The property name you want\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n *\n * @static\n * @const\n */\nfunction computedStyle(el, prop) {\n if (!el || !prop) {\n return '';\n }\n\n if (typeof window.getComputedStyle === 'function') {\n var cs = window.getComputedStyle(el);\n\n return cs ? cs[prop] : '';\n }\n\n return el.currentStyle[prop] || '';\n}\n\nvar _templateObject = taggedTemplateLiteralLoose(['Setting attributes in the second argument of createEl()\\n has been deprecated. Use the third argument instead.\\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.'], ['Setting attributes in the second argument of createEl()\\n has been deprecated. Use the third argument instead.\\n createEl(type, properties, attributes). Attempting to set ', ' to ', '.']);\n\n/**\n * @file dom.js\n * @module dom\n */\n/**\n * Detect if a value is a string with any non-whitespace characters.\n *\n * @param {string} str\n * The string to check\n *\n * @return {boolean}\n * - True if the string is non-blank\n * - False otherwise\n *\n */\nfunction isNonBlankString(str) {\n return typeof str === 'string' && /\\S/.test(str);\n}\n\n/**\n * Throws an error if the passed string has whitespace. This is used by\n * class methods to be relatively consistent with the classList API.\n *\n * @param {string} str\n * The string to check for whitespace.\n *\n * @throws {Error}\n * Throws an error if there is whitespace in the string.\n *\n */\nfunction throwIfWhitespace(str) {\n if (/\\s/.test(str)) {\n throw new Error('class has illegal whitespace characters');\n }\n}\n\n/**\n * Produce a regular expression for matching a className within an elements className.\n *\n * @param {string} className\n * The className to generate the RegExp for.\n *\n * @return {RegExp}\n * The RegExp that will check for a specific `className` in an elements\n * className.\n */\nfunction classRegExp(className) {\n return new RegExp('(^|\\\\s)' + className + '($|\\\\s)');\n}\n\n/**\n * Whether the current DOM interface appears to be real.\n *\n * @return {Boolean}\n */\nfunction isReal() {\n return (\n\n // Both document and window will never be undefined thanks to `global`.\n document === window.document &&\n\n // In IE < 9, DOM methods return \"object\" as their type, so all we can\n // confidently check is that it exists.\n typeof document.createElement !== 'undefined'\n );\n}\n\n/**\n * Determines, via duck typing, whether or not a value is a DOM element.\n *\n * @param {Mixed} value\n * The thing to check\n *\n * @return {boolean}\n * - True if it is a DOM element\n * - False otherwise\n */\nfunction isEl(value) {\n return isObject(value) && value.nodeType === 1;\n}\n\n/**\n * Determines if the current DOM is embedded in an iframe.\n *\n * @return {boolean}\n *\n */\nfunction isInFrame() {\n\n // We need a try/catch here because Safari will throw errors when attempting\n // to get either `parent` or `self`\n try {\n return window.parent !== window.self;\n } catch (x) {\n return true;\n }\n}\n\n/**\n * Creates functions to query the DOM using a given method.\n *\n * @param {string} method\n * The method to create the query with.\n *\n * @return {Function}\n * The query method\n */\nfunction createQuerier(method) {\n return function (selector, context) {\n if (!isNonBlankString(selector)) {\n return document[method](null);\n }\n if (isNonBlankString(context)) {\n context = document.querySelector(context);\n }\n\n var ctx = isEl(context) ? context : document;\n\n return ctx[method] && ctx[method](selector);\n };\n}\n\n/**\n * Creates an element and applies properties.\n *\n * @param {string} [tagName='div']\n * Name of tag to be created.\n *\n * @param {Object} [properties={}]\n * Element properties to be applied.\n *\n * @param {Object} [attributes={}]\n * Element attributes to be applied.\n *\n * @param {String|Element|TextNode|Array|Function} [content]\n * Contents for the element (see: {@link dom:normalizeContent})\n *\n * @return {Element}\n * The element that was created.\n */\nfunction createEl() {\n var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';\n var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var content = arguments[3];\n\n var el = document.createElement(tagName);\n\n Object.getOwnPropertyNames(properties).forEach(function (propName) {\n var val = properties[propName];\n\n // See #2176\n // We originally were accepting both properties and attributes in the\n // same object, but that doesn't work so well.\n if (propName.indexOf('aria-') !== -1 || propName === 'role' || propName === 'type') {\n log.warn(tsml(_templateObject, propName, val));\n el.setAttribute(propName, val);\n\n // Handle textContent since it's not supported everywhere and we have a\n // method for it.\n } else if (propName === 'textContent') {\n textContent(el, val);\n } else {\n el[propName] = val;\n }\n });\n\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n el.setAttribute(attrName, attributes[attrName]);\n });\n\n if (content) {\n appendContent(el, content);\n }\n\n return el;\n}\n\n/**\n * Injects text into an element, replacing any existing contents entirely.\n *\n * @param {Element} el\n * The element to add text content into\n *\n * @param {string} text\n * The text content to add.\n *\n * @return {Element}\n * The element with added text content.\n */\nfunction textContent(el, text) {\n if (typeof el.textContent === 'undefined') {\n el.innerText = text;\n } else {\n el.textContent = text;\n }\n return el;\n}\n\n/**\n * Insert an element as the first child node of another\n *\n * @param {Element} child\n * Element to insert\n *\n * @param {Element} parent\n * Element to insert child into\n */\nfunction prependTo(child, parent) {\n if (parent.firstChild) {\n parent.insertBefore(child, parent.firstChild);\n } else {\n parent.appendChild(child);\n }\n}\n\n/**\n * Check if an element has a CSS class\n *\n * @param {Element} element\n * Element to check\n *\n * @param {string} classToCheck\n * Class name to check for\n *\n * @return {boolean}\n * - True if the element had the class\n * - False otherwise.\n *\n * @throws {Error}\n * Throws an error if `classToCheck` has white space.\n */\nfunction hasClass(element, classToCheck) {\n throwIfWhitespace(classToCheck);\n if (element.classList) {\n return element.classList.contains(classToCheck);\n }\n return classRegExp(classToCheck).test(element.className);\n}\n\n/**\n * Add a CSS class name to an element\n *\n * @param {Element} element\n * Element to add class name to.\n *\n * @param {string} classToAdd\n * Class name to add.\n *\n * @return {Element}\n * The dom element with the added class name.\n */\nfunction addClass(element, classToAdd) {\n if (element.classList) {\n element.classList.add(classToAdd);\n\n // Don't need to `throwIfWhitespace` here because `hasElClass` will do it\n // in the case of classList not being supported.\n } else if (!hasClass(element, classToAdd)) {\n element.className = (element.className + ' ' + classToAdd).trim();\n }\n\n return element;\n}\n\n/**\n * Remove a CSS class name from an element\n *\n * @param {Element} element\n * Element to remove a class name from.\n *\n * @param {string} classToRemove\n * Class name to remove\n *\n * @return {Element}\n * The dom element with class name removed.\n */\nfunction removeClass(element, classToRemove) {\n if (element.classList) {\n element.classList.remove(classToRemove);\n } else {\n throwIfWhitespace(classToRemove);\n element.className = element.className.split(/\\s+/).filter(function (c) {\n return c !== classToRemove;\n }).join(' ');\n }\n\n return element;\n}\n\n/**\n * The callback definition for toggleElClass.\n *\n * @callback Dom~PredicateCallback\n * @param {Element} element\n * The DOM element of the Component.\n *\n * @param {string} classToToggle\n * The `className` that wants to be toggled\n *\n * @return {boolean|undefined}\n * - If true the `classToToggle` will get added to `element`.\n * - If false the `classToToggle` will get removed from `element`.\n * - If undefined this callback will be ignored\n */\n\n/**\n * Adds or removes a CSS class name on an element depending on an optional\n * condition or the presence/absence of the class name.\n *\n * @param {Element} element\n * The element to toggle a class name on.\n *\n * @param {string} classToToggle\n * The class that should be toggled\n *\n * @param {boolean|PredicateCallback} [predicate]\n * See the return value for {@link Dom~PredicateCallback}\n *\n * @return {Element}\n * The element with a class that has been toggled.\n */\nfunction toggleClass(element, classToToggle, predicate) {\n\n // This CANNOT use `classList` internally because IE does not support the\n // second parameter to the `classList.toggle()` method! Which is fine because\n // `classList` will be used by the add/remove functions.\n var has = hasClass(element, classToToggle);\n\n if (typeof predicate === 'function') {\n predicate = predicate(element, classToToggle);\n }\n\n if (typeof predicate !== 'boolean') {\n predicate = !has;\n }\n\n // If the necessary class operation matches the current state of the\n // element, no action is required.\n if (predicate === has) {\n return;\n }\n\n if (predicate) {\n addClass(element, classToToggle);\n } else {\n removeClass(element, classToToggle);\n }\n\n return element;\n}\n\n/**\n * Apply attributes to an HTML element.\n *\n * @param {Element} el\n * Element to add attributes to.\n *\n * @param {Object} [attributes]\n * Attributes to be applied.\n */\nfunction setAttributes(el, attributes) {\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n var attrValue = attributes[attrName];\n\n if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {\n el.removeAttribute(attrName);\n } else {\n el.setAttribute(attrName, attrValue === true ? '' : attrValue);\n }\n });\n}\n\n/**\n * Get an element's attribute values, as defined on the HTML tag\n * Attributes are not the same as properties. They're defined on the tag\n * or with setAttribute (which shouldn't be used with HTML)\n * This will return true or false for boolean attributes.\n *\n * @param {Element} tag\n * Element from which to get tag attributes.\n *\n * @return {Object}\n * All attributes of the element.\n */\nfunction getAttributes(tag) {\n var obj = {};\n\n // known boolean attributes\n // we can check for matching boolean properties, but older browsers\n // won't know about HTML5 boolean attributes that we still read from\n var knownBooleans = ',' + 'autoplay,controls,playsinline,loop,muted,default,defaultMuted' + ',';\n\n if (tag && tag.attributes && tag.attributes.length > 0) {\n var attrs = tag.attributes;\n\n for (var i = attrs.length - 1; i >= 0; i--) {\n var attrName = attrs[i].name;\n var attrVal = attrs[i].value;\n\n // check for known booleans\n // the matching element property will return a value for typeof\n if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(',' + attrName + ',') !== -1) {\n // the value of an included boolean attribute is typically an empty\n // string ('') which would equal false if we just check for a false value.\n // we also don't want support bad code like autoplay='false'\n attrVal = attrVal !== null ? true : false;\n }\n\n obj[attrName] = attrVal;\n }\n }\n\n return obj;\n}\n\n/**\n * Get the value of an element's attribute\n *\n * @param {Element} el\n * A DOM element\n *\n * @param {string} attribute\n * Attribute to get the value of\n *\n * @return {string}\n * value of the attribute\n */\nfunction getAttribute(el, attribute) {\n return el.getAttribute(attribute);\n}\n\n/**\n * Set the value of an element's attribute\n *\n * @param {Element} el\n * A DOM element\n *\n * @param {string} attribute\n * Attribute to set\n *\n * @param {string} value\n * Value to set the attribute to\n */\nfunction setAttribute(el, attribute, value) {\n el.setAttribute(attribute, value);\n}\n\n/**\n * Remove an element's attribute\n *\n * @param {Element} el\n * A DOM element\n *\n * @param {string} attribute\n * Attribute to remove\n */\nfunction removeAttribute(el, attribute) {\n el.removeAttribute(attribute);\n}\n\n/**\n * Attempt to block the ability to select text while dragging controls\n */\nfunction blockTextSelection() {\n document.body.focus();\n document.onselectstart = function () {\n return false;\n };\n}\n\n/**\n * Turn off text selection blocking\n */\nfunction unblockTextSelection() {\n document.onselectstart = function () {\n return true;\n };\n}\n\n/**\n * Identical to the native `getBoundingClientRect` function, but ensures that\n * the method is supported at all (it is in all browsers we claim to support)\n * and that the element is in the DOM before continuing.\n *\n * This wrapper function also shims properties which are not provided by some\n * older browsers (namely, IE8).\n *\n * Additionally, some browsers do not support adding properties to a\n * `ClientRect`/`DOMRect` object; so, we shallow-copy it with the standard\n * properties (except `x` and `y` which are not widely supported). This helps\n * avoid implementations where keys are non-enumerable.\n *\n * @param {Element} el\n * Element whose `ClientRect` we want to calculate.\n *\n * @return {Object|undefined}\n * Always returns a plain\n */\nfunction getBoundingClientRect(el) {\n if (el && el.getBoundingClientRect && el.parentNode) {\n var rect = el.getBoundingClientRect();\n var result = {};\n\n ['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(function (k) {\n if (rect[k] !== undefined) {\n result[k] = rect[k];\n }\n });\n\n if (!result.height) {\n result.height = parseFloat(computedStyle(el, 'height'));\n }\n\n if (!result.width) {\n result.width = parseFloat(computedStyle(el, 'width'));\n }\n\n return result;\n }\n}\n\n/**\n * The postion of a DOM element on the page.\n *\n * @typedef {Object} module:dom~Position\n *\n * @property {number} left\n * Pixels to the left\n *\n * @property {number} top\n * Pixels on top\n */\n\n/**\n * Offset Left.\n * getBoundingClientRect technique from\n * John Resig\n *\n * @see http://ejohn.org/blog/getboundingclientrect-is-awesome/\n *\n * @param {Element} el\n * Element from which to get offset\n *\n * @return {module:dom~Position}\n * The position of the element that was passed in.\n */\nfunction findPosition(el) {\n var box = void 0;\n\n if (el.getBoundingClientRect && el.parentNode) {\n box = el.getBoundingClientRect();\n }\n\n if (!box) {\n return {\n left: 0,\n top: 0\n };\n }\n\n var docEl = document.documentElement;\n var body = document.body;\n\n var clientLeft = docEl.clientLeft || body.clientLeft || 0;\n var scrollLeft = window.pageXOffset || body.scrollLeft;\n var left = box.left + scrollLeft - clientLeft;\n\n var clientTop = docEl.clientTop || body.clientTop || 0;\n var scrollTop = window.pageYOffset || body.scrollTop;\n var top = box.top + scrollTop - clientTop;\n\n // Android sometimes returns slightly off decimal values, so need to round\n return {\n left: Math.round(left),\n top: Math.round(top)\n };\n}\n\n/**\n * x and y coordinates for a dom element or mouse pointer\n *\n * @typedef {Object} Dom~Coordinates\n *\n * @property {number} x\n * x coordinate in pixels\n *\n * @property {number} y\n * y coordinate in pixels\n */\n\n/**\n * Get pointer position in element\n * Returns an object with x and y coordinates.\n * The base on the coordinates are the bottom left of the element.\n *\n * @param {Element} el\n * Element on which to get the pointer position on\n *\n * @param {EventTarget~Event} event\n * Event object\n *\n * @return {Dom~Coordinates}\n * A Coordinates object corresponding to the mouse position.\n *\n */\nfunction getPointerPosition(el, event) {\n var position = {};\n var box = findPosition(el);\n var boxW = el.offsetWidth;\n var boxH = el.offsetHeight;\n\n var boxY = box.top;\n var boxX = box.left;\n var pageY = event.pageY;\n var pageX = event.pageX;\n\n if (event.changedTouches) {\n pageX = event.changedTouches[0].pageX;\n pageY = event.changedTouches[0].pageY;\n }\n\n position.y = Math.max(0, Math.min(1, (boxY - pageY + boxH) / boxH));\n position.x = Math.max(0, Math.min(1, (pageX - boxX) / boxW));\n\n return position;\n}\n\n/**\n * Determines, via duck typing, whether or not a value is a text node.\n *\n * @param {Mixed} value\n * Check if this value is a text node.\n *\n * @return {boolean}\n * - True if it is a text node\n * - False otherwise\n */\nfunction isTextNode(value) {\n return isObject(value) && value.nodeType === 3;\n}\n\n/**\n * Empties the contents of an element.\n *\n * @param {Element} el\n * The element to empty children from\n *\n * @return {Element}\n * The element with no children\n */\nfunction emptyEl(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n return el;\n}\n\n/**\n * Normalizes content for eventual insertion into the DOM.\n *\n * This allows a wide range of content definition methods, but protects\n * from falling into the trap of simply writing to `innerHTML`, which is\n * an XSS concern.\n *\n * The content for an element can be passed in multiple types and\n * combinations, whose behavior is as follows:\n *\n * @param {String|Element|TextNode|Array|Function} content\n * - String: Normalized into a text node.\n * - Element/TextNode: Passed through.\n * - Array: A one-dimensional array of strings, elements, nodes, or functions\n * (which return single strings, elements, or nodes).\n * - Function: If the sole argument, is expected to produce a string, element,\n * node, or array as defined above.\n *\n * @return {Array}\n * All of the content that was passed in normalized.\n */\nfunction normalizeContent(content) {\n\n // First, invoke content if it is a function. If it produces an array,\n // that needs to happen before normalization.\n if (typeof content === 'function') {\n content = content();\n }\n\n // Next up, normalize to an array, so one or many items can be normalized,\n // filtered, and returned.\n return (Array.isArray(content) ? content : [content]).map(function (value) {\n\n // First, invoke value if it is a function to produce a new value,\n // which will be subsequently normalized to a Node of some kind.\n if (typeof value === 'function') {\n value = value();\n }\n\n if (isEl(value) || isTextNode(value)) {\n return value;\n }\n\n if (typeof value === 'string' && /\\S/.test(value)) {\n return document.createTextNode(value);\n }\n }).filter(function (value) {\n return value;\n });\n}\n\n/**\n * Normalizes and appends content to an element.\n *\n * @param {Element} el\n * Element to append normalized content to.\n *\n *\n * @param {String|Element|TextNode|Array|Function} content\n * See the `content` argument of {@link dom:normalizeContent}\n *\n * @return {Element}\n * The element with appended normalized content.\n */\nfunction appendContent(el, content) {\n normalizeContent(content).forEach(function (node) {\n return el.appendChild(node);\n });\n return el;\n}\n\n/**\n * Normalizes and inserts content into an element; this is identical to\n * `appendContent()`, except it empties the element first.\n *\n * @param {Element} el\n * Element to insert normalized content into.\n *\n * @param {String|Element|TextNode|Array|Function} content\n * See the `content` argument of {@link dom:normalizeContent}\n *\n * @return {Element}\n * The element with inserted normalized content.\n *\n */\nfunction insertContent(el, content) {\n return appendContent(emptyEl(el), content);\n}\n\n/**\n * Check if event was a single left click\n *\n * @param {EventTarget~Event} event\n * Event object\n *\n * @return {boolean}\n * - True if a left click\n * - False if not a left click\n */\nfunction isSingleLeftClick(event) {\n // Note: if you create something draggable, be sure to\n // call it on both `mousedown` and `mousemove` event,\n // otherwise `mousedown` should be enough for a button\n\n if (event.button === undefined && event.buttons === undefined) {\n // Why do we need `buttons` ?\n // Because, middle mouse sometimes have this:\n // e.button === 0 and e.buttons === 4\n // Furthermore, we want to prevent combination click, something like\n // HOLD middlemouse then left click, that would be\n // e.button === 0, e.buttons === 5\n // just `button` is not gonna work\n\n // Alright, then what this block does ?\n // this is for chrome `simulate mobile devices`\n // I want to support this as well\n\n return true;\n }\n\n if (event.button === 0 && event.buttons === undefined) {\n // Touch screen, sometimes on some specific device, `buttons`\n // doesn't have anything (safari on ios, blackberry...)\n\n return true;\n }\n\n if (IE_VERSION === 9) {\n // Ignore IE9\n\n return true;\n }\n\n if (event.button !== 0 || event.buttons !== 1) {\n // This is the reason we have those if else block above\n // if any special case we can catch and let it slide\n // we do it above, when get to here, this definitely\n // is-not-left-click\n\n return false;\n }\n\n return true;\n}\n\n/**\n * Finds a single DOM element matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {Element|null}\n * The element that was found or null.\n */\nvar $ = createQuerier('querySelector');\n\n/**\n * Finds a all DOM elements matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {NodeList}\n * A element list of elements that were found. Will be empty if none were found.\n *\n */\nvar $$ = createQuerier('querySelectorAll');\n\n\n\nvar Dom = (Object.freeze || Object)({\n\tisReal: isReal,\n\tisEl: isEl,\n\tisInFrame: isInFrame,\n\tcreateEl: createEl,\n\ttextContent: textContent,\n\tprependTo: prependTo,\n\thasClass: hasClass,\n\taddClass: addClass,\n\tremoveClass: removeClass,\n\ttoggleClass: toggleClass,\n\tsetAttributes: setAttributes,\n\tgetAttributes: getAttributes,\n\tgetAttribute: getAttribute,\n\tsetAttribute: setAttribute,\n\tremoveAttribute: removeAttribute,\n\tblockTextSelection: blockTextSelection,\n\tunblockTextSelection: unblockTextSelection,\n\tgetBoundingClientRect: getBoundingClientRect,\n\tfindPosition: findPosition,\n\tgetPointerPosition: getPointerPosition,\n\tisTextNode: isTextNode,\n\temptyEl: emptyEl,\n\tnormalizeContent: normalizeContent,\n\tappendContent: appendContent,\n\tinsertContent: insertContent,\n\tisSingleLeftClick: isSingleLeftClick,\n\t$: $,\n\t$$: $$\n});\n\n/**\n * @file guid.js\n * @module guid\n */\n\n/**\n * Unique ID for an element or function\n * @type {Number}\n */\nvar _guid = 1;\n\n/**\n * Get a unique auto-incrementing ID by number that has not been returned before.\n *\n * @return {number}\n * A new unique ID.\n */\nfunction newGUID() {\n return _guid++;\n}\n\n/**\n * @file dom-data.js\n * @module dom-data\n */\n/**\n * Element Data Store.\n *\n * Allows for binding data to an element without putting it directly on the\n * element. Ex. Event listeners are stored here.\n * (also from jsninja.com, slightly modified and updated for closure compiler)\n *\n * @type {Object}\n * @private\n */\nvar elData = {};\n\n/*\n * Unique attribute name to store an element's guid in\n *\n * @type {String}\n * @constant\n * @private\n */\nvar elIdAttr = 'vdata' + new Date().getTime();\n\n/**\n * Returns the cache object where data for an element is stored\n *\n * @param {Element} el\n * Element to store data for.\n *\n * @return {Object}\n * The cache object for that el that was passed in.\n */\nfunction getData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n id = el[elIdAttr] = newGUID();\n }\n\n if (!elData[id]) {\n elData[id] = {};\n }\n\n return elData[id];\n}\n\n/**\n * Returns whether or not an element has cached data\n *\n * @param {Element} el\n * Check if this element has cached data.\n *\n * @return {boolean}\n * - True if the DOM element has cached data.\n * - False otherwise.\n */\nfunction hasData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n return false;\n }\n\n return !!Object.getOwnPropertyNames(elData[id]).length;\n}\n\n/**\n * Delete data for the element from the cache and the guid attr from getElementById\n *\n * @param {Element} el\n * Remove cached data for this element.\n */\nfunction removeData(el) {\n var id = el[elIdAttr];\n\n if (!id) {\n return;\n }\n\n // Remove all stored data\n delete elData[id];\n\n // Remove the elIdAttr property from the DOM node\n try {\n delete el[elIdAttr];\n } catch (e) {\n if (el.removeAttribute) {\n el.removeAttribute(elIdAttr);\n } else {\n // IE doesn't appear to support removeAttribute on the document element\n el[elIdAttr] = null;\n }\n }\n}\n\n/**\n * @file events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)\n * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)\n * This should work very similarly to jQuery's events, however it's based off the book version which isn't as\n * robust as jquery's, so there's probably some differences.\n *\n * @module events\n */\n\n/**\n * Clean up the listener cache and dispatchers\n *\n * @param {Element|Object} elem\n * Element to clean up\n *\n * @param {string} type\n * Type of event to clean up\n */\nfunction _cleanUpEvents(elem, type) {\n var data = getData(elem);\n\n // Remove the events of a particular type if there are none left\n if (data.handlers[type].length === 0) {\n delete data.handlers[type];\n // data.handlers[type] = null;\n // Setting to null was causing an error with data.handlers\n\n // Remove the meta-handler from the element\n if (elem.removeEventListener) {\n elem.removeEventListener(type, data.dispatcher, false);\n } else if (elem.detachEvent) {\n elem.detachEvent('on' + type, data.dispatcher);\n }\n }\n\n // Remove the events object if there are no types left\n if (Object.getOwnPropertyNames(data.handlers).length <= 0) {\n delete data.handlers;\n delete data.dispatcher;\n delete data.disabled;\n }\n\n // Finally remove the element data if there is no data left\n if (Object.getOwnPropertyNames(data).length === 0) {\n removeData(elem);\n }\n}\n\n/**\n * Loops through an array of event types and calls the requested method for each type.\n *\n * @param {Function} fn\n * The event method we want to use.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} callback\n * Event listener.\n */\nfunction _handleMultipleEvents(fn, elem, types, callback) {\n types.forEach(function (type) {\n // Call the event method for each one of the types\n fn(elem, type, callback);\n });\n}\n\n/**\n * Fix a native event to have standard property values\n *\n * @param {Object} event\n * Event object to fix.\n *\n * @return {Object}\n * Fixed event object.\n */\nfunction fixEvent(event) {\n\n function returnTrue() {\n return true;\n }\n\n function returnFalse() {\n return false;\n }\n\n // Test if fixing up is needed\n // Used to check if !event.stopPropagation instead of isPropagationStopped\n // But native events return true for stopPropagation, but don't have\n // other expected methods like isPropagationStopped. Seems to be a problem\n // with the Javascript Ninja code. So we're just overriding all events now.\n if (!event || !event.isPropagationStopped) {\n var old = event || window.event;\n\n event = {};\n // Clone the old object so that we can modify the values event = {};\n // IE8 Doesn't like when you mess with native event properties\n // Firefox returns false for event.hasOwnProperty('type') and other props\n // which makes copying more difficult.\n // TODO: Probably best to create a whitelist of event props\n for (var key in old) {\n // Safari 6.0.3 warns you if you try to copy deprecated layerX/Y\n // Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation\n // and webkitMovementX/Y\n if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' && key !== 'webkitMovementX' && key !== 'webkitMovementY') {\n // Chrome 32+ warns if you try to copy deprecated returnValue, but\n // we still want to if preventDefault isn't supported (IE8).\n if (!(key === 'returnValue' && old.preventDefault)) {\n event[key] = old[key];\n }\n }\n }\n\n // The event occurred on this element\n if (!event.target) {\n event.target = event.srcElement || document;\n }\n\n // Handle which other element the event is related to\n if (!event.relatedTarget) {\n event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;\n }\n\n // Stop the default browser action\n event.preventDefault = function () {\n if (old.preventDefault) {\n old.preventDefault();\n }\n event.returnValue = false;\n old.returnValue = false;\n event.defaultPrevented = true;\n };\n\n event.defaultPrevented = false;\n\n // Stop the event from bubbling\n event.stopPropagation = function () {\n if (old.stopPropagation) {\n old.stopPropagation();\n }\n event.cancelBubble = true;\n old.cancelBubble = true;\n event.isPropagationStopped = returnTrue;\n };\n\n event.isPropagationStopped = returnFalse;\n\n // Stop the event from bubbling and executing other handlers\n event.stopImmediatePropagation = function () {\n if (old.stopImmediatePropagation) {\n old.stopImmediatePropagation();\n }\n event.isImmediatePropagationStopped = returnTrue;\n event.stopPropagation();\n };\n\n event.isImmediatePropagationStopped = returnFalse;\n\n // Handle mouse position\n if (event.clientX !== null && event.clientX !== undefined) {\n var doc = document.documentElement;\n var body = document.body;\n\n event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n }\n\n // Handle key presses\n event.which = event.charCode || event.keyCode;\n\n // Fix button for mouse clicks:\n // 0 == left; 1 == middle; 2 == right\n if (event.button !== null && event.button !== undefined) {\n\n // The following is disabled because it does not pass videojs-standard\n // and... yikes.\n /* eslint-disable */\n event.button = event.button & 1 ? 0 : event.button & 4 ? 1 : event.button & 2 ? 2 : 0;\n /* eslint-enable */\n }\n }\n\n // Returns fixed-up instance\n return event;\n}\n\n/**\n * Whether passive event listeners are supported\n */\nvar _supportsPassive = false;\n\n(function () {\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get() {\n _supportsPassive = true;\n }\n });\n\n window.addEventListener('test', null, opts);\n window.removeEventListener('test', null, opts);\n } catch (e) {\n // disregard\n }\n})();\n\n/**\n * Touch events Chrome expects to be passive\n */\nvar passiveEvents = ['touchstart', 'touchmove'];\n\n/**\n * Add an event listener to element\n * It stores the handler function in a separate cache object\n * and adds a generic handler to the element's event,\n * along with a unique id (guid) to the element.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string|string[]} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} fn\n * Event listener.\n */\nfunction on(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(on, elem, type, fn);\n }\n\n var data = getData(elem);\n\n // We need a place to store all our handler data\n if (!data.handlers) {\n data.handlers = {};\n }\n\n if (!data.handlers[type]) {\n data.handlers[type] = [];\n }\n\n if (!fn.guid) {\n fn.guid = newGUID();\n }\n\n data.handlers[type].push(fn);\n\n if (!data.dispatcher) {\n data.disabled = false;\n\n data.dispatcher = function (event, hash) {\n\n if (data.disabled) {\n return;\n }\n\n event = fixEvent(event);\n\n var handlers = data.handlers[event.type];\n\n if (handlers) {\n // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.\n var handlersCopy = handlers.slice(0);\n\n for (var m = 0, n = handlersCopy.length; m < n; m++) {\n if (event.isImmediatePropagationStopped()) {\n break;\n } else {\n try {\n handlersCopy[m].call(elem, event, hash);\n } catch (e) {\n log.error(e);\n }\n }\n }\n }\n };\n }\n\n if (data.handlers[type].length === 1) {\n if (elem.addEventListener) {\n var options = false;\n\n if (_supportsPassive && passiveEvents.indexOf(type) > -1) {\n options = { passive: true };\n }\n elem.addEventListener(type, data.dispatcher, options);\n } else if (elem.attachEvent) {\n elem.attachEvent('on' + type, data.dispatcher);\n }\n }\n}\n\n/**\n * Removes event listeners from an element\n *\n * @param {Element|Object} elem\n * Object to remove listeners from.\n *\n * @param {string|string[]} [type]\n * Type of listener to remove. Don't include to remove all events from element.\n *\n * @param {EventTarget~EventListener} [fn]\n * Specific listener to remove. Don't include to remove listeners for an event\n * type.\n */\nfunction off(elem, type, fn) {\n // Don't want to add a cache object through getElData if not needed\n if (!hasData(elem)) {\n return;\n }\n\n var data = getData(elem);\n\n // If no events exist, nothing to unbind\n if (!data.handlers) {\n return;\n }\n\n if (Array.isArray(type)) {\n return _handleMultipleEvents(off, elem, type, fn);\n }\n\n // Utility function\n var removeType = function removeType(el, t) {\n data.handlers[t] = [];\n _cleanUpEvents(el, t);\n };\n\n // Are we removing all bound events?\n if (type === undefined) {\n for (var t in data.handlers) {\n if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t)) {\n removeType(elem, t);\n }\n }\n return;\n }\n\n var handlers = data.handlers[type];\n\n // If no handlers exist, nothing to unbind\n if (!handlers) {\n return;\n }\n\n // If no listener was provided, remove all listeners for type\n if (!fn) {\n removeType(elem, type);\n return;\n }\n\n // We're only removing a single handler\n if (fn.guid) {\n for (var n = 0; n < handlers.length; n++) {\n if (handlers[n].guid === fn.guid) {\n handlers.splice(n--, 1);\n }\n }\n }\n\n _cleanUpEvents(elem, type);\n}\n\n/**\n * Trigger an event for an element\n *\n * @param {Element|Object} elem\n * Element to trigger an event on\n *\n * @param {EventTarget~Event|string} event\n * A string (the type) or an event object with a type attribute\n *\n * @param {Object} [hash]\n * data hash to pass along with the event\n *\n * @return {boolean|undefined}\n * - Returns the opposite of `defaultPrevented` if default was prevented\n * - Otherwise returns undefined\n */\nfunction trigger(elem, event, hash) {\n // Fetches element data and a reference to the parent (for bubbling).\n // Don't want to add a data object to cache for every parent,\n // so checking hasElData first.\n var elemData = hasData(elem) ? getData(elem) : {};\n var parent = elem.parentNode || elem.ownerDocument;\n // type = event.type || event,\n // handler;\n\n // If an event name was passed as a string, creates an event out of it\n if (typeof event === 'string') {\n event = { type: event, target: elem };\n } else if (!event.target) {\n event.target = elem;\n }\n\n // Normalizes the event properties.\n event = fixEvent(event);\n\n // If the passed element has a dispatcher, executes the established handlers.\n if (elemData.dispatcher) {\n elemData.dispatcher.call(elem, event, hash);\n }\n\n // Unless explicitly stopped or the event does not bubble (e.g. media events)\n // recursively calls this function to bubble the event up the DOM.\n if (parent && !event.isPropagationStopped() && event.bubbles === true) {\n trigger.call(null, parent, event, hash);\n\n // If at the top of the DOM, triggers the default action unless disabled.\n } else if (!parent && !event.defaultPrevented) {\n var targetData = getData(event.target);\n\n // Checks if the target has a default action for this event.\n if (event.target[event.type]) {\n // Temporarily disables event dispatching on the target as we have already executed the handler.\n targetData.disabled = true;\n // Executes the default action.\n if (typeof event.target[event.type] === 'function') {\n event.target[event.type]();\n }\n // Re-enables event dispatching.\n targetData.disabled = false;\n }\n }\n\n // Inform the triggerer if the default was prevented by returning false\n return !event.defaultPrevented;\n}\n\n/**\n * Trigger a listener only once for an event\n *\n * @param {Element|Object} elem\n * Element or object to bind to.\n *\n * @param {string|string[]} type\n * Name/type of event\n *\n * @param {Event~EventListener} fn\n * Event Listener function\n */\nfunction one(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(one, elem, type, fn);\n }\n var func = function func() {\n off(elem, type, func);\n fn.apply(this, arguments);\n };\n\n // copy the guid to the new function so it can removed using the original function's ID\n func.guid = fn.guid = fn.guid || newGUID();\n on(elem, type, func);\n}\n\nvar Events = (Object.freeze || Object)({\n\tfixEvent: fixEvent,\n\ton: on,\n\toff: off,\n\ttrigger: trigger,\n\tone: one\n});\n\n/**\n * @file setup.js - Functions for setting up a player without\n * user interaction based on the data-setup `attribute` of the video tag.\n *\n * @module setup\n */\nvar _windowLoaded = false;\nvar videojs$2 = void 0;\n\n/**\n * Set up any tags that have a data-setup `attribute` when the player is started.\n */\nvar autoSetup = function autoSetup() {\n\n // Protect against breakage in non-browser environments and check global autoSetup option.\n if (!isReal() || videojs$2.options.autoSetup === false) {\n return;\n }\n\n // One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack*\n // var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));\n // var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));\n // var mediaEls = vids.concat(audios);\n\n // Because IE8 doesn't support calling slice on a node list, we need to loop\n // through each list of elements to build up a new, combined list of elements.\n var vids = document.getElementsByTagName('video');\n var audios = document.getElementsByTagName('audio');\n var divs = document.getElementsByTagName('video-js');\n var mediaEls = [];\n\n if (vids && vids.length > 0) {\n for (var i = 0, e = vids.length; i < e; i++) {\n mediaEls.push(vids[i]);\n }\n }\n\n if (audios && audios.length > 0) {\n for (var _i = 0, _e = audios.length; _i < _e; _i++) {\n mediaEls.push(audios[_i]);\n }\n }\n\n if (divs && divs.length > 0) {\n for (var _i2 = 0, _e2 = divs.length; _i2 < _e2; _i2++) {\n mediaEls.push(divs[_i2]);\n }\n }\n\n // Check if any media elements exist\n if (mediaEls && mediaEls.length > 0) {\n\n for (var _i3 = 0, _e3 = mediaEls.length; _i3 < _e3; _i3++) {\n var mediaEl = mediaEls[_i3];\n\n // Check if element exists, has getAttribute func.\n // IE seems to consider typeof el.getAttribute == 'object' instead of\n // 'function' like expected, at least when loading the player immediately.\n if (mediaEl && mediaEl.getAttribute) {\n\n // Make sure this player hasn't already been set up.\n if (mediaEl.player === undefined) {\n var options = mediaEl.getAttribute('data-setup');\n\n // Check if data-setup attr exists.\n // We only auto-setup if they've added the data-setup attr.\n if (options !== null) {\n // Create new video.js instance.\n videojs$2(mediaEl);\n }\n }\n\n // If getAttribute isn't defined, we need to wait for the DOM.\n } else {\n autoSetupTimeout(1);\n break;\n }\n }\n\n // No videos were found, so keep looping unless page is finished loading.\n } else if (!_windowLoaded) {\n autoSetupTimeout(1);\n }\n};\n\n/**\n * Wait until the page is loaded before running autoSetup. This will be called in\n * autoSetup if `hasLoaded` returns false.\n *\n * @param {number} wait\n * How long to wait in ms\n *\n * @param {module:videojs} [vjs]\n * The videojs library function\n */\nfunction autoSetupTimeout(wait, vjs) {\n if (vjs) {\n videojs$2 = vjs;\n }\n\n window.setTimeout(autoSetup, wait);\n}\n\nif (isReal() && document.readyState === 'complete') {\n _windowLoaded = true;\n} else {\n /**\n * Listen for the load event on window, and set _windowLoaded to true.\n *\n * @listens load\n */\n one(window, 'load', function () {\n _windowLoaded = true;\n });\n}\n\n/**\n * @file stylesheet.js\n * @module stylesheet\n */\n/**\n * Create a DOM syle element given a className for it.\n *\n * @param {string} className\n * The className to add to the created style element.\n *\n * @return {Element}\n * The element that was created.\n */\nvar createStyleElement = function createStyleElement(className) {\n var style = document.createElement('style');\n\n style.className = className;\n\n return style;\n};\n\n/**\n * Add text to a DOM element.\n *\n * @param {Element} el\n * The Element to add text content to.\n *\n * @param {string} content\n * The text to add to the element.\n */\nvar setTextContent = function setTextContent(el, content) {\n if (el.styleSheet) {\n el.styleSheet.cssText = content;\n } else {\n el.textContent = content;\n }\n};\n\n/**\n * @file fn.js\n * @module fn\n */\n/**\n * Bind (a.k.a proxy or Context). A simple method for changing the context of a function\n * It also stores a unique id on the function so it can be easily removed from events.\n *\n * @param {Mixed} context\n * The object to bind as scope.\n *\n * @param {Function} fn\n * The function to be bound to a scope.\n *\n * @param {number} [uid]\n * An optional unique ID for the function to be set\n *\n * @return {Function}\n * The new function that will be bound into the context given\n */\nvar bind = function bind(context, fn, uid) {\n // Make sure the function has a unique ID\n if (!fn.guid) {\n fn.guid = newGUID();\n }\n\n // Create the new function that changes the context\n var bound = function bound() {\n return fn.apply(context, arguments);\n };\n\n // Allow for the ability to individualize this function\n // Needed in the case where multiple objects might share the same prototype\n // IF both items add an event listener with the same function, then you try to remove just one\n // it will remove both because they both have the same guid.\n // when using this, you need to use the bind method when you remove the listener as well.\n // currently used in text tracks\n bound.guid = uid ? uid + '_' + fn.guid : fn.guid;\n\n return bound;\n};\n\n/**\n * Wraps the given function, `fn`, with a new function that only invokes `fn`\n * at most once per every `wait` milliseconds.\n *\n * @param {Function} fn\n * The function to be throttled.\n *\n * @param {Number} wait\n * The number of milliseconds by which to throttle.\n *\n * @return {Function}\n */\nvar throttle = function throttle(fn, wait) {\n var last = Date.now();\n\n var throttled = function throttled() {\n var now = Date.now();\n\n if (now - last >= wait) {\n fn.apply(undefined, arguments);\n last = now;\n }\n };\n\n return throttled;\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked.\n *\n * Inspired by lodash and underscore implementations.\n *\n * @param {Function} func\n * The function to wrap with debounce behavior.\n *\n * @param {number} wait\n * The number of milliseconds to wait after the last invocation.\n *\n * @param {boolean} [immediate]\n * Whether or not to invoke the function immediately upon creation.\n *\n * @param {Object} [context=window]\n * The \"context\" in which the debounced function should debounce. For\n * example, if this function should be tied to a Video.js player,\n * the player can be passed here. Alternatively, defaults to the\n * global `window` object.\n *\n * @return {Function}\n * A debounced function.\n */\nvar debounce = function debounce(func, wait, immediate) {\n var context = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window;\n\n var timeout = void 0;\n\n var cancel = function cancel() {\n context.clearTimeout(timeout);\n timeout = null;\n };\n\n /* eslint-disable consistent-this */\n var debounced = function debounced() {\n var self = this;\n var args = arguments;\n\n var _later = function later() {\n timeout = null;\n _later = null;\n if (!immediate) {\n func.apply(self, args);\n }\n };\n\n if (!timeout && immediate) {\n func.apply(self, args);\n }\n\n context.clearTimeout(timeout);\n timeout = context.setTimeout(_later, wait);\n };\n /* eslint-enable consistent-this */\n\n debounced.cancel = cancel;\n\n return debounced;\n};\n\n/**\n * @file src/js/event-target.js\n */\n/**\n * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It\n * adds shorthand functions that wrap around lengthy functions. For example:\n * the `on` function is a wrapper around `addEventListener`.\n *\n * @see [EventTarget Spec]{@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget}\n * @class EventTarget\n */\nvar EventTarget = function EventTarget() {};\n\n/**\n * A Custom DOM event.\n *\n * @typedef {Object} EventTarget~Event\n * @see [Properties]{@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n */\n\n/**\n * All event listeners should follow the following format.\n *\n * @callback EventTarget~EventListener\n * @this {EventTarget}\n *\n * @param {EventTarget~Event} event\n * the event that triggered this function\n *\n * @param {Object} [hash]\n * hash of data sent during the event\n */\n\n/**\n * An object containing event names as keys and booleans as values.\n *\n * > NOTE: If an event name is set to a true value here {@link EventTarget#trigger}\n * will have extra functionality. See that function for more information.\n *\n * @property EventTarget.prototype.allowedEvents_\n * @private\n */\nEventTarget.prototype.allowedEvents_ = {};\n\n/**\n * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a\n * function that will get called when an event with a certain name gets triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to call with `EventTarget`s\n */\nEventTarget.prototype.on = function (type, fn) {\n // Remove the addEventListener alias before calling Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n on(this, type, fn);\n this.addEventListener = ael;\n};\n\n/**\n * An alias of {@link EventTarget#on}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#on}\n */\nEventTarget.prototype.addEventListener = EventTarget.prototype.on;\n\n/**\n * Removes an `event listener` for a specific event from an instance of `EventTarget`.\n * This makes it so that the `event listener` will no longer get called when the\n * named event happens.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to remove.\n */\nEventTarget.prototype.off = function (type, fn) {\n off(this, type, fn);\n};\n\n/**\n * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#off}\n */\nEventTarget.prototype.removeEventListener = EventTarget.prototype.off;\n\n/**\n * This function will add an `event listener` that gets triggered only once. After the\n * first trigger it will get removed. This is like adding an `event listener`\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to be called once for each event name.\n */\nEventTarget.prototype.one = function (type, fn) {\n // Remove the addEventListener alialing Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n one(this, type, fn);\n this.addEventListener = ael;\n};\n\n/**\n * This function causes an event to happen. This will then cause any `event listeners`\n * that are waiting for that event, to get called. If there are no `event listeners`\n * for an event then nothing will happen.\n *\n * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`.\n * Trigger will also call the `on` + `uppercaseEventName` function.\n *\n * Example:\n * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call\n * `onClick` if it exists.\n *\n * @param {string|EventTarget~Event|Object} event\n * The name of the event, an `Event`, or an object with a key of type set to\n * an event name.\n */\nEventTarget.prototype.trigger = function (event) {\n var type = event.type || event;\n\n if (typeof event === 'string') {\n event = { type: type };\n }\n event = fixEvent(event);\n\n if (this.allowedEvents_[type] && this['on' + type]) {\n this['on' + type](event);\n }\n\n trigger(this, event);\n};\n\n/**\n * An alias of {@link EventTarget#trigger}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#trigger}\n */\nEventTarget.prototype.dispatchEvent = EventTarget.prototype.trigger;\n\n/**\n * @file mixins/evented.js\n * @module evented\n */\n/**\n * Returns whether or not an object has had the evented mixin applied.\n *\n * @param {Object} object\n * An object to test.\n *\n * @return {boolean}\n * Whether or not the object appears to be evented.\n */\nvar isEvented = function isEvented(object) {\n return object instanceof EventTarget || !!object.eventBusEl_ && ['on', 'one', 'off', 'trigger'].every(function (k) {\n return typeof object[k] === 'function';\n });\n};\n\n/**\n * Whether a value is a valid event type - non-empty string or array.\n *\n * @private\n * @param {string|Array} type\n * The type value to test.\n *\n * @return {boolean}\n * Whether or not the type is a valid event type.\n */\nvar isValidEventType = function isValidEventType(type) {\n return (\n // The regex here verifies that the `type` contains at least one non-\n // whitespace character.\n typeof type === 'string' && /\\S/.test(type) || Array.isArray(type) && !!type.length\n );\n};\n\n/**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the target does not appear to be a valid event target.\n *\n * @param {Object} target\n * The object to test.\n */\nvar validateTarget = function validateTarget(target) {\n if (!target.nodeName && !isEvented(target)) {\n throw new Error('Invalid target; must be a DOM node or evented object.');\n }\n};\n\n/**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the type does not appear to be a valid event type.\n *\n * @param {string|Array} type\n * The type to test.\n */\nvar validateEventType = function validateEventType(type) {\n if (!isValidEventType(type)) {\n throw new Error('Invalid event type; must be a non-empty string or array.');\n }\n};\n\n/**\n * Validates a value to determine if it is a valid listener. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the listener is not a function.\n *\n * @param {Function} listener\n * The listener to test.\n */\nvar validateListener = function validateListener(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Invalid listener; must be a function.');\n }\n};\n\n/**\n * Takes an array of arguments given to `on()` or `one()`, validates them, and\n * normalizes them into an object.\n *\n * @private\n * @param {Object} self\n * The evented object on which `on()` or `one()` was called. This\n * object will be bound as the `this` value for the listener.\n *\n * @param {Array} args\n * An array of arguments passed to `on()` or `one()`.\n *\n * @return {Object}\n * An object containing useful values for `on()` or `one()` calls.\n */\nvar normalizeListenArgs = function normalizeListenArgs(self, args) {\n\n // If the number of arguments is less than 3, the target is always the\n // evented object itself.\n var isTargetingSelf = args.length < 3 || args[0] === self || args[0] === self.eventBusEl_;\n var target = void 0;\n var type = void 0;\n var listener = void 0;\n\n if (isTargetingSelf) {\n target = self.eventBusEl_;\n\n // Deal with cases where we got 3 arguments, but we are still listening to\n // the evented object itself.\n if (args.length >= 3) {\n args.shift();\n }\n\n type = args[0];\n listener = args[1];\n } else {\n target = args[0];\n type = args[1];\n listener = args[2];\n }\n\n validateTarget(target);\n validateEventType(type);\n validateListener(listener);\n\n listener = bind(self, listener);\n\n return { isTargetingSelf: isTargetingSelf, target: target, type: type, listener: listener };\n};\n\n/**\n * Adds the listener to the event type(s) on the target, normalizing for\n * the type of target.\n *\n * @private\n * @param {Element|Object} target\n * A DOM node or evented object.\n *\n * @param {string} method\n * The event binding method to use (\"on\" or \"one\").\n *\n * @param {string|Array} type\n * One or more event type(s).\n *\n * @param {Function} listener\n * A listener function.\n */\nvar listen = function listen(target, method, type, listener) {\n validateTarget(target);\n\n if (target.nodeName) {\n Events[method](target, type, listener);\n } else {\n target[method](type, listener);\n }\n};\n\n/**\n * Contains methods that provide event capabilites to an object which is passed\n * to {@link module:evented|evented}.\n *\n * @mixin EventedMixin\n */\nvar EventedMixin = {\n\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n on: function on$$1() {\n var _this = this;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _normalizeListenArgs = normalizeListenArgs(this, args),\n isTargetingSelf = _normalizeListenArgs.isTargetingSelf,\n target = _normalizeListenArgs.target,\n type = _normalizeListenArgs.type,\n listener = _normalizeListenArgs.listener;\n\n listen(target, 'on', type, listener);\n\n // If this object is listening to another evented object.\n if (!isTargetingSelf) {\n\n // If this object is disposed, remove the listener.\n var removeListenerOnDispose = function removeListenerOnDispose() {\n return _this.off(target, type, listener);\n };\n\n // Use the same function ID as the listener so we can remove it later it\n // using the ID of the original listener.\n removeListenerOnDispose.guid = listener.guid;\n\n // Add a listener to the target's dispose event as well. This ensures\n // that if the target is disposed BEFORE this object, we remove the\n // removal listener that was just added. Otherwise, we create a memory leak.\n var removeRemoverOnTargetDispose = function removeRemoverOnTargetDispose() {\n return _this.off('dispose', removeListenerOnDispose);\n };\n\n // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n removeRemoverOnTargetDispose.guid = listener.guid;\n\n listen(this, 'on', 'dispose', removeListenerOnDispose);\n listen(target, 'on', 'dispose', removeRemoverOnTargetDispose);\n }\n },\n\n\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object. The listener will only be called once and then removed.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n one: function one$$1() {\n var _this2 = this;\n\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var _normalizeListenArgs2 = normalizeListenArgs(this, args),\n isTargetingSelf = _normalizeListenArgs2.isTargetingSelf,\n target = _normalizeListenArgs2.target,\n type = _normalizeListenArgs2.type,\n listener = _normalizeListenArgs2.listener;\n\n // Targeting this evented object.\n\n\n if (isTargetingSelf) {\n listen(target, 'one', type, listener);\n\n // Targeting another evented object.\n } else {\n var wrapper = function wrapper() {\n for (var _len3 = arguments.length, largs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n largs[_key3] = arguments[_key3];\n }\n\n _this2.off(target, type, wrapper);\n listener.apply(null, largs);\n };\n\n // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n wrapper.guid = listener.guid;\n listen(target, 'one', type, wrapper);\n }\n },\n\n\n /**\n * Removes listener(s) from event(s) on an evented object.\n *\n * @param {string|Array|Element|Object} [targetOrType]\n * If this is a string or array, it represents the event type(s).\n *\n * Another evented object can be passed here instead, in which case\n * ALL 3 arguments are _required_.\n *\n * @param {string|Array|Function} [typeOrListener]\n * If the first argument was a string or array, this may be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function; otherwise, _all_ listeners bound to the\n * event type(s) will be removed.\n */\n off: function off$$1(targetOrType, typeOrListener, listener) {\n\n // Targeting this evented object.\n if (!targetOrType || isValidEventType(targetOrType)) {\n off(this.eventBusEl_, targetOrType, typeOrListener);\n\n // Targeting another evented object.\n } else {\n var target = targetOrType;\n var type = typeOrListener;\n\n // Fail fast and in a meaningful way!\n validateTarget(target);\n validateEventType(type);\n validateListener(listener);\n\n // Ensure there's at least a guid, even if the function hasn't been used\n listener = bind(this, listener);\n\n // Remove the dispose listener on this evented object, which was given\n // the same guid as the event listener in on().\n this.off('dispose', listener);\n\n if (target.nodeName) {\n off(target, type, listener);\n off(target, 'dispose', listener);\n } else if (isEvented(target)) {\n target.off(type, listener);\n target.off('dispose', listener);\n }\n }\n },\n\n\n /**\n * Fire an event on this evented object, causing its listeners to be called.\n *\n * @param {string|Object} event\n * An event type or an object with a type property.\n *\n * @param {Object} [hash]\n * An additional object to pass along to listeners.\n *\n * @returns {boolean}\n * Whether or not the default behavior was prevented.\n */\n trigger: function trigger$$1(event, hash) {\n return trigger(this.eventBusEl_, event, hash);\n }\n};\n\n/**\n * Applies {@link module:evented~EventedMixin|EventedMixin} to a target object.\n *\n * @param {Object} target\n * The object to which to add event methods.\n *\n * @param {Object} [options={}]\n * Options for customizing the mixin behavior.\n *\n * @param {String} [options.eventBusKey]\n * By default, adds a `eventBusEl_` DOM element to the target object,\n * which is used as an event bus. If the target object already has a\n * DOM element that should be used, pass its key here.\n *\n * @return {Object}\n * The target object.\n */\nfunction evented(target) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var eventBusKey = options.eventBusKey;\n\n // Set or create the eventBusEl_.\n\n if (eventBusKey) {\n if (!target[eventBusKey].nodeName) {\n throw new Error('The eventBusKey \"' + eventBusKey + '\" does not refer to an element.');\n }\n target.eventBusEl_ = target[eventBusKey];\n } else {\n target.eventBusEl_ = createEl('span', { className: 'vjs-event-bus' });\n }\n\n assign(target, EventedMixin);\n\n // When any evented object is disposed, it removes all its listeners.\n target.on('dispose', function () {\n target.off();\n window.setTimeout(function () {\n target.eventBusEl_ = null;\n }, 0);\n });\n\n return target;\n}\n\n/**\n * @file mixins/stateful.js\n * @module stateful\n */\n/**\n * Contains methods that provide statefulness to an object which is passed\n * to {@link module:stateful}.\n *\n * @mixin StatefulMixin\n */\nvar StatefulMixin = {\n\n /**\n * A hash containing arbitrary keys and values representing the state of\n * the object.\n *\n * @type {Object}\n */\n state: {},\n\n /**\n * Set the state of an object by mutating its\n * {@link module:stateful~StatefulMixin.state|state} object in place.\n *\n * @fires module:stateful~StatefulMixin#statechanged\n * @param {Object|Function} stateUpdates\n * A new set of properties to shallow-merge into the plugin state.\n * Can be a plain object or a function returning a plain object.\n *\n * @returns {Object|undefined}\n * An object containing changes that occurred. If no changes\n * occurred, returns `undefined`.\n */\n setState: function setState(stateUpdates) {\n var _this = this;\n\n // Support providing the `stateUpdates` state as a function.\n if (typeof stateUpdates === 'function') {\n stateUpdates = stateUpdates();\n }\n\n var changes = void 0;\n\n each(stateUpdates, function (value, key) {\n\n // Record the change if the value is different from what's in the\n // current state.\n if (_this.state[key] !== value) {\n changes = changes || {};\n changes[key] = {\n from: _this.state[key],\n to: value\n };\n }\n\n _this.state[key] = value;\n });\n\n // Only trigger \"statechange\" if there were changes AND we have a trigger\n // function. This allows us to not require that the target object be an\n // evented object.\n if (changes && isEvented(this)) {\n\n /**\n * An event triggered on an object that is both\n * {@link module:stateful|stateful} and {@link module:evented|evented}\n * indicating that its state has changed.\n *\n * @event module:stateful~StatefulMixin#statechanged\n * @type {Object}\n * @property {Object} changes\n * A hash containing the properties that were changed and\n * the values they were changed `from` and `to`.\n */\n this.trigger({\n changes: changes,\n type: 'statechanged'\n });\n }\n\n return changes;\n }\n};\n\n/**\n * Applies {@link module:stateful~StatefulMixin|StatefulMixin} to a target\n * object.\n *\n * If the target object is {@link module:evented|evented} and has a\n * `handleStateChanged` method, that method will be automatically bound to the\n * `statechanged` event on itself.\n *\n * @param {Object} target\n * The object to be made stateful.\n *\n * @param {Object} [defaultState]\n * A default set of properties to populate the newly-stateful object's\n * `state` property.\n *\n * @returns {Object}\n * Returns the `target`.\n */\nfunction stateful(target, defaultState) {\n assign(target, StatefulMixin);\n\n // This happens after the mixing-in because we need to replace the `state`\n // added in that step.\n target.state = assign({}, target.state, defaultState);\n\n // Auto-bind the `handleStateChanged` method of the target object if it exists.\n if (typeof target.handleStateChanged === 'function' && isEvented(target)) {\n target.on('statechanged', target.handleStateChanged);\n }\n\n return target;\n}\n\n/**\n * @file to-title-case.js\n * @module to-title-case\n */\n\n/**\n * Uppercase the first letter of a string.\n *\n * @param {string} string\n * String to be uppercased\n *\n * @return {string}\n * The string with an uppercased first letter\n */\nfunction toTitleCase(string) {\n if (typeof string !== 'string') {\n return string;\n }\n\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\n/**\n * Compares the TitleCase versions of the two strings for equality.\n *\n * @param {string} str1\n * The first string to compare\n *\n * @param {string} str2\n * The second string to compare\n *\n * @return {boolean}\n * Whether the TitleCase versions of the strings are equal\n */\nfunction titleCaseEquals(str1, str2) {\n return toTitleCase(str1) === toTitleCase(str2);\n}\n\n/**\n * @file merge-options.js\n * @module merge-options\n */\n/**\n * Deep-merge one or more options objects, recursively merging **only** plain\n * object properties.\n *\n * @param {Object[]} sources\n * One or more objects to merge into a new object.\n *\n * @returns {Object}\n * A new object that is the merged result of all sources.\n */\nfunction mergeOptions() {\n var result = {};\n\n for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n each(source, function (value, key) {\n if (!isPlain(value)) {\n result[key] = value;\n return;\n }\n\n if (!isPlain(result[key])) {\n result[key] = {};\n }\n\n result[key] = mergeOptions(result[key], value);\n });\n });\n\n return result;\n}\n\n/**\n * Player Component - Base class for all UI objects\n *\n * @file component.js\n */\n/**\n * Base class for all UI Components.\n * Components are UI objects which represent both a javascript object and an element\n * in the DOM. They can be children of other components, and can have\n * children themselves.\n *\n * Components can also use methods from {@link EventTarget}\n */\n\nvar Component = function () {\n\n /**\n * A callback that is called when a component is ready. Does not have any\n * paramters and any callback value will be ignored.\n *\n * @callback Component~ReadyCallback\n * @this Component\n */\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Object[]} [options.children]\n * An array of children objects to intialize this component with. Children objects have\n * a name property that will be used if more than one component of the same type needs to be\n * added.\n *\n * @param {Component~ReadyCallback} [ready]\n * Function that gets called when the `Component` is ready.\n */\n function Component(player, options, ready) {\n classCallCheck(this, Component);\n\n\n // The component might be the player itself and we can't pass `this` to super\n if (!player && this.play) {\n this.player_ = player = this; // eslint-disable-line\n } else {\n this.player_ = player;\n }\n\n // Make a copy of prototype.options_ to protect against overriding defaults\n this.options_ = mergeOptions({}, this.options_);\n\n // Updated options with supplied options\n options = this.options_ = mergeOptions(this.options_, options);\n\n // Get ID from options or options element if one is supplied\n this.id_ = options.id || options.el && options.el.id;\n\n // If there was no ID from the options, generate one\n if (!this.id_) {\n // Don't require the player ID function in the case of mock players\n var id = player && player.id && player.id() || 'no_player';\n\n this.id_ = id + '_component_' + newGUID();\n }\n\n this.name_ = options.name || null;\n\n // Create element if one wasn't provided in options\n if (options.el) {\n this.el_ = options.el;\n } else if (options.createEl !== false) {\n this.el_ = this.createEl();\n }\n\n // if evented is anything except false, we want to mixin in evented\n if (options.evented !== false) {\n // Make this an evented object and use `el_`, if available, as its event bus\n evented(this, { eventBusKey: this.el_ ? 'el_' : null });\n }\n stateful(this, this.constructor.defaultState);\n\n this.children_ = [];\n this.childIndex_ = {};\n this.childNameIndex_ = {};\n\n // Add any child components in options\n if (options.initChildren !== false) {\n this.initChildren();\n }\n\n this.ready(ready);\n // Don't want to trigger ready here or it will before init is actually\n // finished for all children that run this constructor\n\n if (options.reportTouchActivity !== false) {\n this.enableTouchActivity();\n }\n }\n\n /**\n * Dispose of the `Component` and all child components.\n *\n * @fires Component#dispose\n */\n\n\n Component.prototype.dispose = function dispose() {\n\n /**\n * Triggered when a `Component` is disposed.\n *\n * @event Component#dispose\n * @type {EventTarget~Event}\n *\n * @property {boolean} [bubbles=false]\n * set to false so that the close event does not\n * bubble up\n */\n this.trigger({ type: 'dispose', bubbles: false });\n\n // Dispose all children.\n if (this.children_) {\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i].dispose) {\n this.children_[i].dispose();\n }\n }\n }\n\n // Delete child references\n this.children_ = null;\n this.childIndex_ = null;\n this.childNameIndex_ = null;\n\n if (this.el_) {\n // Remove element from DOM\n if (this.el_.parentNode) {\n this.el_.parentNode.removeChild(this.el_);\n }\n\n removeData(this.el_);\n this.el_ = null;\n }\n\n // remove reference to the player after disposing of the element\n this.player_ = null;\n };\n\n /**\n * Return the {@link Player} that the `Component` has attached to.\n *\n * @return {Player}\n * The player that this `Component` has attached to.\n */\n\n\n Component.prototype.player = function player() {\n return this.player_;\n };\n\n /**\n * Deep merge of options objects with new options.\n * > Note: When both `obj` and `options` contain properties whose values are objects.\n * The two properties get merged using {@link module:mergeOptions}\n *\n * @param {Object} obj\n * The object that contains new options.\n *\n * @return {Object}\n * A new object of `this.options_` and `obj` merged together.\n *\n * @deprecated since version 5\n */\n\n\n Component.prototype.options = function options(obj) {\n log.warn('this.options() has been deprecated and will be moved to the constructor in 6.0');\n\n if (!obj) {\n return this.options_;\n }\n\n this.options_ = mergeOptions(this.options_, obj);\n return this.options_;\n };\n\n /**\n * Get the `Component`s DOM element\n *\n * @return {Element}\n * The DOM element for this `Component`.\n */\n\n\n Component.prototype.el = function el() {\n return this.el_;\n };\n\n /**\n * Create the `Component`s DOM element.\n *\n * @param {string} [tagName]\n * Element's DOM node type. e.g. 'div'\n *\n * @param {Object} [properties]\n * An object of properties that should be set.\n *\n * @param {Object} [attributes]\n * An object of attributes that should be set.\n *\n * @return {Element}\n * The element that gets created.\n */\n\n\n Component.prototype.createEl = function createEl$$1(tagName, properties, attributes) {\n return createEl(tagName, properties, attributes);\n };\n\n /**\n * Localize a string given the string in english.\n *\n * If tokens are provided, it'll try and run a simple token replacement on the provided string.\n * The tokens it looks for look like `{1}` with the index being 1-indexed into the tokens array.\n *\n * If a `defaultValue` is provided, it'll use that over `string`,\n * if a value isn't found in provided language files.\n * This is useful if you want to have a descriptive key for token replacement\n * but have a succinct localized string and not require `en.json` to be included.\n *\n * Currently, it is used for the progress bar timing.\n * ```js\n * {\n * \"progress bar timing: currentTime={1} duration={2}\": \"{1} of {2}\"\n * }\n * ```\n * It is then used like so:\n * ```js\n * this.localize('progress bar timing: currentTime={1} duration{2}',\n * [this.player_.currentTime(), this.player_.duration()],\n * '{1} of {2}');\n * ```\n *\n * Which outputs something like: `01:23 of 24:56`.\n *\n *\n * @param {string} string\n * The string to localize and the key to lookup in the language files.\n * @param {string[]} [tokens]\n * If the current item has token replacements, provide the tokens here.\n * @param {string} [defaultValue]\n * Defaults to `string`. Can be a default value to use for token replacement\n * if the lookup key is needed to be separate.\n *\n * @return {string}\n * The localized string or if no localization exists the english string.\n */\n\n\n Component.prototype.localize = function localize(string, tokens) {\n var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : string;\n\n var code = this.player_.language && this.player_.language();\n var languages = this.player_.languages && this.player_.languages();\n var language = languages && languages[code];\n var primaryCode = code && code.split('-')[0];\n var primaryLang = languages && languages[primaryCode];\n\n var localizedString = defaultValue;\n\n if (language && language[string]) {\n localizedString = language[string];\n } else if (primaryLang && primaryLang[string]) {\n localizedString = primaryLang[string];\n }\n\n if (tokens) {\n localizedString = localizedString.replace(/\\{(\\d+)\\}/g, function (match, index) {\n var value = tokens[index - 1];\n var ret = value;\n\n if (typeof value === 'undefined') {\n ret = match;\n }\n\n return ret;\n });\n }\n\n return localizedString;\n };\n\n /**\n * Return the `Component`s DOM element. This is where children get inserted.\n * This will usually be the the same as the element returned in {@link Component#el}.\n *\n * @return {Element}\n * The content element for this `Component`.\n */\n\n\n Component.prototype.contentEl = function contentEl() {\n return this.contentEl_ || this.el_;\n };\n\n /**\n * Get this `Component`s ID\n *\n * @return {string}\n * The id of this `Component`\n */\n\n\n Component.prototype.id = function id() {\n return this.id_;\n };\n\n /**\n * Get the `Component`s name. The name gets used to reference the `Component`\n * and is set during registration.\n *\n * @return {string}\n * The name of this `Component`.\n */\n\n\n Component.prototype.name = function name() {\n return this.name_;\n };\n\n /**\n * Get an array of all child components\n *\n * @return {Array}\n * The children\n */\n\n\n Component.prototype.children = function children() {\n return this.children_;\n };\n\n /**\n * Returns the child `Component` with the given `id`.\n *\n * @param {string} id\n * The id of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `id` or undefined.\n */\n\n\n Component.prototype.getChildById = function getChildById(id) {\n return this.childIndex_[id];\n };\n\n /**\n * Returns the child `Component` with the given `name`.\n *\n * @param {string} name\n * The name of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `name` or undefined.\n */\n\n\n Component.prototype.getChild = function getChild(name) {\n if (!name) {\n return;\n }\n\n name = toTitleCase(name);\n\n return this.childNameIndex_[name];\n };\n\n /**\n * Add a child `Component` inside the current `Component`.\n *\n *\n * @param {string|Component} child\n * The name or instance of a child to add.\n *\n * @param {Object} [options={}]\n * The key/value store of options that will get passed to children of\n * the child.\n *\n * @param {number} [index=this.children_.length]\n * The index to attempt to add a child into.\n *\n * @return {Component}\n * The `Component` that gets added as a child. When using a string the\n * `Component` will get created by this process.\n */\n\n\n Component.prototype.addChild = function addChild(child) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.children_.length;\n\n var component = void 0;\n var componentName = void 0;\n\n // If child is a string, create component with options\n if (typeof child === 'string') {\n componentName = toTitleCase(child);\n\n var componentClassName = options.componentClass || componentName;\n\n // Set name through options\n options.name = componentName;\n\n // Create a new object & element for this controls set\n // If there's no .player_, this is a player\n var ComponentClass = Component.getComponent(componentClassName);\n\n if (!ComponentClass) {\n throw new Error('Component ' + componentClassName + ' does not exist');\n }\n\n // data stored directly on the videojs object may be\n // misidentified as a component to retain\n // backwards-compatibility with 4.x. check to make sure the\n // component class can be instantiated.\n if (typeof ComponentClass !== 'function') {\n return null;\n }\n\n component = new ComponentClass(this.player_ || this, options);\n\n // child is a component instance\n } else {\n component = child;\n }\n\n this.children_.splice(index, 0, component);\n\n if (typeof component.id === 'function') {\n this.childIndex_[component.id()] = component;\n }\n\n // If a name wasn't used to create the component, check if we can use the\n // name function of the component\n componentName = componentName || component.name && toTitleCase(component.name());\n\n if (componentName) {\n this.childNameIndex_[componentName] = component;\n }\n\n // Add the UI object's element to the container div (box)\n // Having an element is not required\n if (typeof component.el === 'function' && component.el()) {\n var childNodes = this.contentEl().children;\n var refNode = childNodes[index] || null;\n\n this.contentEl().insertBefore(component.el(), refNode);\n }\n\n // Return so it can stored on parent object if desired.\n return component;\n };\n\n /**\n * Remove a child `Component` from this `Component`s list of children. Also removes\n * the child `Component`s element from this `Component`s element.\n *\n * @param {Component} component\n * The child `Component` to remove.\n */\n\n\n Component.prototype.removeChild = function removeChild(component) {\n if (typeof component === 'string') {\n component = this.getChild(component);\n }\n\n if (!component || !this.children_) {\n return;\n }\n\n var childFound = false;\n\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i] === component) {\n childFound = true;\n this.children_.splice(i, 1);\n break;\n }\n }\n\n if (!childFound) {\n return;\n }\n\n this.childIndex_[component.id()] = null;\n this.childNameIndex_[component.name()] = null;\n\n var compEl = component.el();\n\n if (compEl && compEl.parentNode === this.contentEl()) {\n this.contentEl().removeChild(component.el());\n }\n };\n\n /**\n * Add and initialize default child `Component`s based upon options.\n */\n\n\n Component.prototype.initChildren = function initChildren() {\n var _this = this;\n\n var children = this.options_.children;\n\n if (children) {\n // `this` is `parent`\n var parentOptions = this.options_;\n\n var handleAdd = function handleAdd(child) {\n var name = child.name;\n var opts = child.opts;\n\n // Allow options for children to be set at the parent options\n // e.g. videojs(id, { controlBar: false });\n // instead of videojs(id, { children: { controlBar: false });\n if (parentOptions[name] !== undefined) {\n opts = parentOptions[name];\n }\n\n // Allow for disabling default components\n // e.g. options['children']['posterImage'] = false\n if (opts === false) {\n return;\n }\n\n // Allow options to be passed as a simple boolean if no configuration\n // is necessary.\n if (opts === true) {\n opts = {};\n }\n\n // We also want to pass the original player options\n // to each component as well so they don't need to\n // reach back into the player for options later.\n opts.playerOptions = _this.options_.playerOptions;\n\n // Create and add the child component.\n // Add a direct reference to the child by name on the parent instance.\n // If two of the same component are used, different names should be supplied\n // for each\n var newChild = _this.addChild(name, opts);\n\n if (newChild) {\n _this[name] = newChild;\n }\n };\n\n // Allow for an array of children details to passed in the options\n var workingChildren = void 0;\n var Tech = Component.getComponent('Tech');\n\n if (Array.isArray(children)) {\n workingChildren = children;\n } else {\n workingChildren = Object.keys(children);\n }\n\n workingChildren\n // children that are in this.options_ but also in workingChildren would\n // give us extra children we do not want. So, we want to filter them out.\n .concat(Object.keys(this.options_).filter(function (child) {\n return !workingChildren.some(function (wchild) {\n if (typeof wchild === 'string') {\n return child === wchild;\n }\n return child === wchild.name;\n });\n })).map(function (child) {\n var name = void 0;\n var opts = void 0;\n\n if (typeof child === 'string') {\n name = child;\n opts = children[name] || _this.options_[name] || {};\n } else {\n name = child.name;\n opts = child;\n }\n\n return { name: name, opts: opts };\n }).filter(function (child) {\n // we have to make sure that child.name isn't in the techOrder since\n // techs are registerd as Components but can't aren't compatible\n // See https://github.com/videojs/video.js/issues/2772\n var c = Component.getComponent(child.opts.componentClass || toTitleCase(child.name));\n\n return c && !Tech.isTech(c);\n }).forEach(handleAdd);\n }\n };\n\n /**\n * Builds the default DOM class name. Should be overriden by sub-components.\n *\n * @return {string}\n * The DOM class name for this object.\n *\n * @abstract\n */\n\n\n Component.prototype.buildCSSClass = function buildCSSClass() {\n // Child classes can include a function that does:\n // return 'CLASS NAME' + this._super();\n return '';\n };\n\n /**\n * Bind a listener to the component's ready state.\n * Different from event listeners in that if the ready event has already happened\n * it will trigger the function immediately.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n\n\n Component.prototype.ready = function ready(fn) {\n var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (!fn) {\n return;\n }\n\n if (!this.isReady_) {\n this.readyQueue_ = this.readyQueue_ || [];\n this.readyQueue_.push(fn);\n return;\n }\n\n if (sync) {\n fn.call(this);\n } else {\n // Call the function asynchronously by default for consistency\n this.setTimeout(fn, 1);\n }\n };\n\n /**\n * Trigger all the ready listeners for this `Component`.\n *\n * @fires Component#ready\n */\n\n\n Component.prototype.triggerReady = function triggerReady() {\n this.isReady_ = true;\n\n // Ensure ready is triggered asynchronously\n this.setTimeout(function () {\n var readyQueue = this.readyQueue_;\n\n // Reset Ready Queue\n this.readyQueue_ = [];\n\n if (readyQueue && readyQueue.length > 0) {\n readyQueue.forEach(function (fn) {\n fn.call(this);\n }, this);\n }\n\n // Allow for using event listeners also\n /**\n * Triggered when a `Component` is ready.\n *\n * @event Component#ready\n * @type {EventTarget~Event}\n */\n this.trigger('ready');\n }, 1);\n };\n\n /**\n * Find a single DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {Element|null}\n * the dom element that was found, or null\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n\n\n Component.prototype.$ = function $$$1(selector, context) {\n return $(selector, context || this.contentEl());\n };\n\n /**\n * Finds all DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {NodeList}\n * a list of dom elements that were found\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n\n\n Component.prototype.$$ = function $$$$1(selector, context) {\n return $$(selector, context || this.contentEl());\n };\n\n /**\n * Check if a component's element has a CSS class name.\n *\n * @param {string} classToCheck\n * CSS class name to check.\n *\n * @return {boolean}\n * - True if the `Component` has the class.\n * - False if the `Component` does not have the class`\n */\n\n\n Component.prototype.hasClass = function hasClass$$1(classToCheck) {\n return hasClass(this.el_, classToCheck);\n };\n\n /**\n * Add a CSS class name to the `Component`s element.\n *\n * @param {string} classToAdd\n * CSS class name to add\n */\n\n\n Component.prototype.addClass = function addClass$$1(classToAdd) {\n addClass(this.el_, classToAdd);\n };\n\n /**\n * Remove a CSS class name from the `Component`s element.\n *\n * @param {string} classToRemove\n * CSS class name to remove\n */\n\n\n Component.prototype.removeClass = function removeClass$$1(classToRemove) {\n removeClass(this.el_, classToRemove);\n };\n\n /**\n * Add or remove a CSS class name from the component's element.\n * - `classToToggle` gets added when {@link Component#hasClass} would return false.\n * - `classToToggle` gets removed when {@link Component#hasClass} would return true.\n *\n * @param {string} classToToggle\n * The class to add or remove based on (@link Component#hasClass}\n *\n * @param {boolean|Dom~predicate} [predicate]\n * An {@link Dom~predicate} function or a boolean\n */\n\n\n Component.prototype.toggleClass = function toggleClass$$1(classToToggle, predicate) {\n toggleClass(this.el_, classToToggle, predicate);\n };\n\n /**\n * Show the `Component`s element if it is hidden by removing the\n * 'vjs-hidden' class name from it.\n */\n\n\n Component.prototype.show = function show() {\n this.removeClass('vjs-hidden');\n };\n\n /**\n * Hide the `Component`s element if it is currently showing by adding the\n * 'vjs-hidden` class name to it.\n */\n\n\n Component.prototype.hide = function hide() {\n this.addClass('vjs-hidden');\n };\n\n /**\n * Lock a `Component`s element in its visible state by adding the 'vjs-lock-showing'\n * class name to it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n\n\n Component.prototype.lockShowing = function lockShowing() {\n this.addClass('vjs-lock-showing');\n };\n\n /**\n * Unlock a `Component`s element from its visible state by removing the 'vjs-lock-showing'\n * class name from it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n\n\n Component.prototype.unlockShowing = function unlockShowing() {\n this.removeClass('vjs-lock-showing');\n };\n\n /**\n * Get the value of an attribute on the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to get the value from.\n *\n * @return {string|null}\n * - The value of the attribute that was asked for.\n * - Can be an empty string on some browsers if the attribute does not exist\n * or has no value\n * - Most browsers will return null if the attibute does not exist or has\n * no value.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute}\n */\n\n\n Component.prototype.getAttribute = function getAttribute$$1(attribute) {\n return getAttribute(this.el_, attribute);\n };\n\n /**\n * Set the value of an attribute on the `Component`'s element\n *\n * @param {string} attribute\n * Name of the attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute}\n */\n\n\n Component.prototype.setAttribute = function setAttribute$$1(attribute, value) {\n setAttribute(this.el_, attribute, value);\n };\n\n /**\n * Remove an attribute from the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to remove.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute}\n */\n\n\n Component.prototype.removeAttribute = function removeAttribute$$1(attribute) {\n removeAttribute(this.el_, attribute);\n };\n\n /**\n * Get or set the width of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The width that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|string}\n * The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n */\n\n\n Component.prototype.width = function width(num, skipListeners) {\n return this.dimension('width', num, skipListeners);\n };\n\n /**\n * Get or set the height of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The height that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|string}\n * The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n */\n\n\n Component.prototype.height = function height(num, skipListeners) {\n return this.dimension('height', num, skipListeners);\n };\n\n /**\n * Set both the width and height of the `Component` element at the same time.\n *\n * @param {number|string} width\n * Width to set the `Component`s element to.\n *\n * @param {number|string} height\n * Height to set the `Component`s element to.\n */\n\n\n Component.prototype.dimensions = function dimensions(width, height) {\n // Skip componentresize listeners on width for optimization\n this.width(width, true);\n this.height(height);\n };\n\n /**\n * Get or set width or height of the `Component` element. This is the shared code\n * for the {@link Component#width} and {@link Component#height}.\n *\n * Things to know:\n * - If the width or height in an number this will return the number postfixed with 'px'.\n * - If the width/height is a percent this will return the percent postfixed with '%'\n * - Hidden elements have a width of 0 with `window.getComputedStyle`. This function\n * defaults to the `Component`s `style.width` and falls back to `window.getComputedStyle`.\n * See [this]{@link http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/}\n * for more information\n * - If you want the computed style of the component, use {@link Component#currentWidth}\n * and {@link {Component#currentHeight}\n *\n * @fires Component#componentresize\n *\n * @param {string} widthOrHeight\n 8 'width' or 'height'\n *\n * @param {number|string} [num]\n 8 New dimension\n *\n * @param {boolean} [skipListeners]\n * Skip componentresize event trigger\n *\n * @return {number}\n * The dimension when getting or 0 if unset\n */\n\n\n Component.prototype.dimension = function dimension(widthOrHeight, num, skipListeners) {\n if (num !== undefined) {\n // Set to zero if null or literally NaN (NaN !== NaN)\n if (num === null || num !== num) {\n num = 0;\n }\n\n // Check if using css width/height (% or px) and adjust\n if (('' + num).indexOf('%') !== -1 || ('' + num).indexOf('px') !== -1) {\n this.el_.style[widthOrHeight] = num;\n } else if (num === 'auto') {\n this.el_.style[widthOrHeight] = '';\n } else {\n this.el_.style[widthOrHeight] = num + 'px';\n }\n\n // skipListeners allows us to avoid triggering the resize event when setting both width and height\n if (!skipListeners) {\n /**\n * Triggered when a component is resized.\n *\n * @event Component#componentresize\n * @type {EventTarget~Event}\n */\n this.trigger('componentresize');\n }\n\n return;\n }\n\n // Not setting a value, so getting it\n // Make sure element exists\n if (!this.el_) {\n return 0;\n }\n\n // Get dimension value from style\n var val = this.el_.style[widthOrHeight];\n var pxIndex = val.indexOf('px');\n\n if (pxIndex !== -1) {\n // Return the pixel value with no 'px'\n return parseInt(val.slice(0, pxIndex), 10);\n }\n\n // No px so using % or no style was set, so falling back to offsetWidth/height\n // If component has display:none, offset will return 0\n // TODO: handle display:none and no dimension style using px\n return parseInt(this.el_['offset' + toTitleCase(widthOrHeight)], 10);\n };\n\n /**\n * Get the computed width or the height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @param {string} widthOrHeight\n * A string containing 'width' or 'height'. Whichever one you want to get.\n *\n * @return {number}\n * The dimension that gets asked for or 0 if nothing was set\n * for that dimension.\n */\n\n\n Component.prototype.currentDimension = function currentDimension(widthOrHeight) {\n var computedWidthOrHeight = 0;\n\n if (widthOrHeight !== 'width' && widthOrHeight !== 'height') {\n throw new Error('currentDimension only accepts width or height value');\n }\n\n if (typeof window.getComputedStyle === 'function') {\n var computedStyle = window.getComputedStyle(this.el_);\n\n computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[widthOrHeight];\n }\n\n // remove 'px' from variable and parse as integer\n computedWidthOrHeight = parseFloat(computedWidthOrHeight);\n\n // if the computed value is still 0, it's possible that the browser is lying\n // and we want to check the offset values.\n // This code also runs on IE8 and wherever getComputedStyle doesn't exist.\n if (computedWidthOrHeight === 0) {\n var rule = 'offset' + toTitleCase(widthOrHeight);\n\n computedWidthOrHeight = this.el_[rule];\n }\n\n return computedWidthOrHeight;\n };\n\n /**\n * An object that contains width and height values of the `Component`s\n * computed style. Uses `window.getComputedStyle`.\n *\n * @typedef {Object} Component~DimensionObject\n *\n * @property {number} width\n * The width of the `Component`s computed style.\n *\n * @property {number} height\n * The height of the `Component`s computed style.\n */\n\n /**\n * Get an object that contains computed width and height values of the\n * component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {Component~DimensionObject}\n * The computed dimensions of the component's element.\n */\n\n\n Component.prototype.currentDimensions = function currentDimensions() {\n return {\n width: this.currentDimension('width'),\n height: this.currentDimension('height')\n };\n };\n\n /**\n * Get the computed width of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed width of the component's element.\n */\n\n\n Component.prototype.currentWidth = function currentWidth() {\n return this.currentDimension('width');\n };\n\n /**\n * Get the computed height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed height of the component's element.\n */\n\n\n Component.prototype.currentHeight = function currentHeight() {\n return this.currentDimension('height');\n };\n\n /**\n * Set the focus to this component\n */\n\n\n Component.prototype.focus = function focus() {\n this.el_.focus();\n };\n\n /**\n * Remove the focus from this component\n */\n\n\n Component.prototype.blur = function blur() {\n this.el_.blur();\n };\n\n /**\n * Emit a 'tap' events when touch event support gets detected. This gets used to\n * support toggling the controls through a tap on the video. They get enabled\n * because every sub-component would have extra overhead otherwise.\n *\n * @private\n * @fires Component#tap\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchleave\n * @listens Component#touchcancel\n * @listens Component#touchend\n */\n\n\n Component.prototype.emitTapEvents = function emitTapEvents() {\n // Track the start time so we can determine how long the touch lasted\n var touchStart = 0;\n var firstTouch = null;\n\n // Maximum movement allowed during a touch event to still be considered a tap\n // Other popular libs use anywhere from 2 (hammer.js) to 15,\n // so 10 seems like a nice, round number.\n var tapMovementThreshold = 10;\n\n // The maximum length a touch can be while still being considered a tap\n var touchTimeThreshold = 200;\n\n var couldBeTap = void 0;\n\n this.on('touchstart', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length === 1) {\n // Copy pageX/pageY from the object\n firstTouch = {\n pageX: event.touches[0].pageX,\n pageY: event.touches[0].pageY\n };\n // Record start time so we can detect a tap vs. \"touch and hold\"\n touchStart = new Date().getTime();\n // Reset couldBeTap tracking\n couldBeTap = true;\n }\n });\n\n this.on('touchmove', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length > 1) {\n couldBeTap = false;\n } else if (firstTouch) {\n // Some devices will throw touchmoves for all but the slightest of taps.\n // So, if we moved only a small distance, this could still be a tap\n var xdiff = event.touches[0].pageX - firstTouch.pageX;\n var ydiff = event.touches[0].pageY - firstTouch.pageY;\n var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n\n if (touchDistance > tapMovementThreshold) {\n couldBeTap = false;\n }\n }\n });\n\n var noTap = function noTap() {\n couldBeTap = false;\n };\n\n // TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s\n this.on('touchleave', noTap);\n this.on('touchcancel', noTap);\n\n // When the touch ends, measure how long it took and trigger the appropriate\n // event\n this.on('touchend', function (event) {\n firstTouch = null;\n // Proceed only if the touchmove/leave/cancel event didn't happen\n if (couldBeTap === true) {\n // Measure how long the touch lasted\n var touchTime = new Date().getTime() - touchStart;\n\n // Make sure the touch was less than the threshold to be considered a tap\n if (touchTime < touchTimeThreshold) {\n // Don't let browser turn this into a click\n event.preventDefault();\n /**\n * Triggered when a `Component` is tapped.\n *\n * @event Component#tap\n * @type {EventTarget~Event}\n */\n this.trigger('tap');\n // It may be good to copy the touchend event object and change the\n // type to tap, if the other event properties aren't exact after\n // Events.fixEvent runs (e.g. event.target)\n }\n }\n });\n };\n\n /**\n * This function reports user activity whenever touch events happen. This can get\n * turned off by any sub-components that wants touch events to act another way.\n *\n * Report user touch activity when touch events occur. User activity gets used to\n * determine when controls should show/hide. It is simple when it comes to mouse\n * events, because any mouse event should show the controls. So we capture mouse\n * events that bubble up to the player and report activity when that happens.\n * With touch events it isn't as easy as `touchstart` and `touchend` toggle player\n * controls. So touch events can't help us at the player level either.\n *\n * User activity gets checked asynchronously. So what could happen is a tap event\n * on the video turns the controls off. Then the `touchend` event bubbles up to\n * the player. Which, if it reported user activity, would turn the controls right\n * back on. We also don't want to completely block touch events from bubbling up.\n * Furthermore a `touchmove` event and anything other than a tap, should not turn\n * controls back on.\n *\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchend\n * @listens Component#touchcancel\n */\n\n\n Component.prototype.enableTouchActivity = function enableTouchActivity() {\n // Don't continue if the root player doesn't support reporting user activity\n if (!this.player() || !this.player().reportUserActivity) {\n return;\n }\n\n // listener for reporting that the user is active\n var report = bind(this.player(), this.player().reportUserActivity);\n\n var touchHolding = void 0;\n\n this.on('touchstart', function () {\n report();\n // For as long as the they are touching the device or have their mouse down,\n // we consider them active even if they're not moving their finger or mouse.\n // So we want to continue to update that they are active\n this.clearInterval(touchHolding);\n // report at the same interval as activityCheck\n touchHolding = this.setInterval(report, 250);\n });\n\n var touchEnd = function touchEnd(event) {\n report();\n // stop the interval that maintains activity if the touch is holding\n this.clearInterval(touchHolding);\n };\n\n this.on('touchmove', report);\n this.on('touchend', touchEnd);\n this.on('touchcancel', touchEnd);\n };\n\n /**\n * A callback that has no parameters and is bound into `Component`s context.\n *\n * @callback Component~GenericCallback\n * @this Component\n */\n\n /**\n * Creates a function that runs after an `x` millisecond timeout. This function is a\n * wrapper around `window.setTimeout`. There are a few reasons to use this one\n * instead though:\n * 1. It gets cleared via {@link Component#clearTimeout} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will gets turned into a {@link Component~GenericCallback}\n *\n * > Note: You can't use `window.clearTimeout` on the id returned by this function. This\n * will cause its dispose listener not to get cleaned up! Please use\n * {@link Component#clearTimeout} or {@link Component#dispose} instead.\n *\n * @param {Component~GenericCallback} fn\n * The function that will be run after `timeout`.\n *\n * @param {number} timeout\n * Timeout in milliseconds to delay before executing the specified function.\n *\n * @return {number}\n * Returns a timeout ID that gets used to identify the timeout. It can also\n * get used in {@link Component#clearTimeout} to clear the timeout that\n * was set.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout}\n */\n\n\n Component.prototype.setTimeout = function setTimeout(fn, timeout) {\n var _this2 = this;\n\n // declare as variables so they are properly available in timeout function\n // eslint-disable-next-line\n var timeoutId, disposeFn;\n\n fn = bind(this, fn);\n\n timeoutId = window.setTimeout(function () {\n _this2.off('dispose', disposeFn);\n fn();\n }, timeout);\n\n disposeFn = function disposeFn() {\n return _this2.clearTimeout(timeoutId);\n };\n\n disposeFn.guid = 'vjs-timeout-' + timeoutId;\n\n this.on('dispose', disposeFn);\n\n return timeoutId;\n };\n\n /**\n * Clears a timeout that gets created via `window.setTimeout` or\n * {@link Component#setTimeout}. If you set a timeout via {@link Component#setTimeout}\n * use this function instead of `window.clearTimout`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} timeoutId\n * The id of the timeout to clear. The return value of\n * {@link Component#setTimeout} or `window.setTimeout`.\n *\n * @return {number}\n * Returns the timeout id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearTimeout}\n */\n\n\n Component.prototype.clearTimeout = function clearTimeout(timeoutId) {\n window.clearTimeout(timeoutId);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = 'vjs-timeout-' + timeoutId;\n\n this.off('dispose', disposeFn);\n\n return timeoutId;\n };\n\n /**\n * Creates a function that gets run every `x` milliseconds. This function is a wrapper\n * around `window.setInterval`. There are a few reasons to use this one instead though.\n * 1. It gets cleared via {@link Component#clearInterval} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will be a {@link Component~GenericCallback}\n *\n * @param {Component~GenericCallback} fn\n * The function to run every `x` seconds.\n *\n * @param {number} interval\n * Execute the specified function every `x` milliseconds.\n *\n * @return {number}\n * Returns an id that can be used to identify the interval. It can also be be used in\n * {@link Component#clearInterval} to clear the interval.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval}\n */\n\n\n Component.prototype.setInterval = function setInterval(fn, interval) {\n var _this3 = this;\n\n fn = bind(this, fn);\n\n var intervalId = window.setInterval(fn, interval);\n\n var disposeFn = function disposeFn() {\n return _this3.clearInterval(intervalId);\n };\n\n disposeFn.guid = 'vjs-interval-' + intervalId;\n\n this.on('dispose', disposeFn);\n\n return intervalId;\n };\n\n /**\n * Clears an interval that gets created via `window.setInterval` or\n * {@link Component#setInterval}. If you set an inteval via {@link Component#setInterval}\n * use this function instead of `window.clearInterval`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} intervalId\n * The id of the interval to clear. The return value of\n * {@link Component#setInterval} or `window.setInterval`.\n *\n * @return {number}\n * Returns the interval id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearInterval}\n */\n\n\n Component.prototype.clearInterval = function clearInterval(intervalId) {\n window.clearInterval(intervalId);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = 'vjs-interval-' + intervalId;\n\n this.off('dispose', disposeFn);\n\n return intervalId;\n };\n\n /**\n * Queues up a callback to be passed to requestAnimationFrame (rAF), but\n * with a few extra bonuses:\n *\n * - Supports browsers that do not support rAF by falling back to\n * {@link Component#setTimeout}.\n *\n * - The callback is turned into a {@link Component~GenericCallback} (i.e.\n * bound to the component).\n *\n * - Automatic cancellation of the rAF callback is handled if the component\n * is disposed before it is called.\n *\n * @param {Component~GenericCallback} fn\n * A function that will be bound to this component and executed just\n * before the browser's next repaint.\n *\n * @return {number}\n * Returns an rAF ID that gets used to identify the timeout. It can\n * also be used in {@link Component#cancelAnimationFrame} to cancel\n * the animation frame callback.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame}\n */\n\n\n Component.prototype.requestAnimationFrame = function requestAnimationFrame(fn) {\n var _this4 = this;\n\n // declare as variables so they are properly available in rAF function\n // eslint-disable-next-line\n var id, disposeFn;\n\n if (this.supportsRaf_) {\n fn = bind(this, fn);\n\n id = window.requestAnimationFrame(function () {\n _this4.off('dispose', disposeFn);\n fn();\n });\n\n disposeFn = function disposeFn() {\n return _this4.cancelAnimationFrame(id);\n };\n\n disposeFn.guid = 'vjs-raf-' + id;\n this.on('dispose', disposeFn);\n\n return id;\n }\n\n // Fall back to using a timer.\n return this.setTimeout(fn, 1000 / 60);\n };\n\n /**\n * Cancels a queued callback passed to {@link Component#requestAnimationFrame}\n * (rAF).\n *\n * If you queue an rAF callback via {@link Component#requestAnimationFrame},\n * use this function instead of `window.cancelAnimationFrame`. If you don't,\n * your dispose listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} id\n * The rAF ID to clear. The return value of {@link Component#requestAnimationFrame}.\n *\n * @return {number}\n * Returns the rAF ID that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/cancelAnimationFrame}\n */\n\n\n Component.prototype.cancelAnimationFrame = function cancelAnimationFrame(id) {\n if (this.supportsRaf_) {\n window.cancelAnimationFrame(id);\n\n var disposeFn = function disposeFn() {};\n\n disposeFn.guid = 'vjs-raf-' + id;\n\n this.off('dispose', disposeFn);\n\n return id;\n }\n\n // Fall back to using a timer.\n return this.clearTimeout(id);\n };\n\n /**\n * Register a `Component` with `videojs` given the name and the component.\n *\n * > NOTE: {@link Tech}s should not be registered as a `Component`. {@link Tech}s\n * should be registered using {@link Tech.registerTech} or\n * {@link videojs:videojs.registerTech}.\n *\n * > NOTE: This function can also be seen on videojs as\n * {@link videojs:videojs.registerComponent}.\n *\n * @param {string} name\n * The name of the `Component` to register.\n *\n * @param {Component} ComponentToRegister\n * The `Component` class to register.\n *\n * @return {Component}\n * The `Component` that was registered.\n */\n\n\n Component.registerComponent = function registerComponent(name, ComponentToRegister) {\n if (typeof name !== 'string' || !name) {\n throw new Error('Illegal component name, \"' + name + '\"; must be a non-empty string.');\n }\n\n var Tech = Component.getComponent('Tech');\n\n // We need to make sure this check is only done if Tech has been registered.\n var isTech = Tech && Tech.isTech(ComponentToRegister);\n var isComp = Component === ComponentToRegister || Component.prototype.isPrototypeOf(ComponentToRegister.prototype);\n\n if (isTech || !isComp) {\n var reason = void 0;\n\n if (isTech) {\n reason = 'techs must be registered using Tech.registerTech()';\n } else {\n reason = 'must be a Component subclass';\n }\n\n throw new Error('Illegal component, \"' + name + '\"; ' + reason + '.');\n }\n\n name = toTitleCase(name);\n\n if (!Component.components_) {\n Component.components_ = {};\n }\n\n var Player = Component.getComponent('Player');\n\n if (name === 'Player' && Player && Player.players) {\n var players = Player.players;\n var playerNames = Object.keys(players);\n\n // If we have players that were disposed, then their name will still be\n // in Players.players. So, we must loop through and verify that the value\n // for each item is not null. This allows registration of the Player component\n // after all players have been disposed or before any were created.\n if (players && playerNames.length > 0 && playerNames.map(function (pname) {\n return players[pname];\n }).every(Boolean)) {\n throw new Error('Can not register Player component after player has been created.');\n }\n }\n\n Component.components_[name] = ComponentToRegister;\n\n return ComponentToRegister;\n };\n\n /**\n * Get a `Component` based on the name it was registered with.\n *\n * @param {string} name\n * The Name of the component to get.\n *\n * @return {Component}\n * The `Component` that got registered under the given name.\n *\n * @deprecated In `videojs` 6 this will not return `Component`s that were not\n * registered using {@link Component.registerComponent}. Currently we\n * check the global `videojs` object for a `Component` name and\n * return that if it exists.\n */\n\n\n Component.getComponent = function getComponent(name) {\n if (!name) {\n return;\n }\n\n name = toTitleCase(name);\n\n if (Component.components_ && Component.components_[name]) {\n return Component.components_[name];\n }\n };\n\n return Component;\n}();\n\n/**\n * Whether or not this component supports `requestAnimationFrame`.\n *\n * This is exposed primarily for testing purposes.\n *\n * @private\n * @type {Boolean}\n */\n\n\nComponent.prototype.supportsRaf_ = typeof window.requestAnimationFrame === 'function' && typeof window.cancelAnimationFrame === 'function';\n\nComponent.registerComponent('Component', Component);\n\n/**\n * @file time-ranges.js\n * @module time-ranges\n */\n\n/**\n * Returns the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @function time-ranges:indexFunction\n *\n * @param {number} [index=0]\n * The range number to return the time for.\n *\n * @return {number}\n * The time that offset at the specified index.\n *\n * @depricated index must be set to a value, in the future this will throw an error.\n */\n\n/**\n * An object that contains ranges of time for various reasons.\n *\n * @typedef {Object} TimeRange\n *\n * @property {number} length\n * The number of time ranges represented by this Object\n *\n * @property {time-ranges:indexFunction} start\n * Returns the time offset at which a specified time range begins.\n *\n * @property {time-ranges:indexFunction} end\n * Returns the time offset at which a specified time range ends.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges\n */\n\n/**\n * Check if any of the time ranges are over the maximum index.\n *\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {number} index\n * The index to check\n *\n * @param {number} maxIndex\n * The maximum possible index\n *\n * @throws {Error} if the timeRanges provided are over the maxIndex\n */\nfunction rangeCheck(fnName, index, maxIndex) {\n if (typeof index !== 'number' || index < 0 || index > maxIndex) {\n throw new Error('Failed to execute \\'' + fnName + '\\' on \\'TimeRanges\\': The index provided (' + index + ') is non-numeric or out of bounds (0-' + maxIndex + ').');\n }\n}\n\n/**\n * Get the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {string} valueIndex\n * The proprety that should be used to get the time. should be 'start' or 'end'\n *\n * @param {Array} ranges\n * An array of time ranges\n *\n * @param {Array} [rangeIndex=0]\n * The index to start the search at\n *\n * @return {number}\n * The time that offset at the specified index.\n *\n *\n * @depricated rangeIndex must be set to a value, in the future this will throw an error.\n * @throws {Error} if rangeIndex is more than the length of ranges\n */\nfunction getRange(fnName, valueIndex, ranges, rangeIndex) {\n rangeCheck(fnName, rangeIndex, ranges.length - 1);\n return ranges[rangeIndex][valueIndex];\n}\n\n/**\n * Create a time range object given ranges of time.\n *\n * @param {Array} [ranges]\n * An array of time ranges.\n */\nfunction createTimeRangesObj(ranges) {\n if (ranges === undefined || ranges.length === 0) {\n return {\n length: 0,\n start: function start() {\n throw new Error('This TimeRanges object is empty');\n },\n end: function end() {\n throw new Error('This TimeRanges object is empty');\n }\n };\n }\n return {\n length: ranges.length,\n start: getRange.bind(null, 'start', 0, ranges),\n end: getRange.bind(null, 'end', 1, ranges)\n };\n}\n\n/**\n * Should create a fake `TimeRange` object which mimics an HTML5 time range instance.\n *\n * @param {number|Array} start\n * The start of a single range or an array of ranges\n *\n * @param {number} end\n * The end of a single range.\n *\n * @private\n */\nfunction createTimeRanges(start, end) {\n if (Array.isArray(start)) {\n return createTimeRangesObj(start);\n } else if (start === undefined || end === undefined) {\n return createTimeRangesObj();\n }\n return createTimeRangesObj([[start, end]]);\n}\n\n/**\n * @file buffer.js\n * @module buffer\n */\n/**\n * Compute the percentage of the media that has been buffered.\n *\n * @param {TimeRange} buffered\n * The current `TimeRange` object representing buffered time ranges\n *\n * @param {number} duration\n * Total duration of the media\n *\n * @return {number}\n * Percent buffered of the total duration in decimal form.\n */\nfunction bufferedPercent(buffered, duration) {\n var bufferedDuration = 0;\n var start = void 0;\n var end = void 0;\n\n if (!duration) {\n return 0;\n }\n\n if (!buffered || !buffered.length) {\n buffered = createTimeRanges(0, 0);\n }\n\n for (var i = 0; i < buffered.length; i++) {\n start = buffered.start(i);\n end = buffered.end(i);\n\n // buffered end can be bigger than duration by a very small fraction\n if (end > duration) {\n end = duration;\n }\n\n bufferedDuration += end - start;\n }\n\n return bufferedDuration / duration;\n}\n\n/**\n * @file fullscreen-api.js\n * @module fullscreen-api\n * @private\n */\n/**\n * Store the browser-specific methods for the fullscreen API.\n *\n * @type {Object}\n * @see [Specification]{@link https://fullscreen.spec.whatwg.org}\n * @see [Map Approach From Screenfull.js]{@link https://github.com/sindresorhus/screenfull.js}\n */\nvar FullscreenApi = {};\n\n// browser API methods\nvar apiMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],\n// WebKit\n['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],\n// Old WebKit (Safari 5.1)\n['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'],\n// Mozilla\n['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'],\n// Microsoft\n['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];\n\nvar specApi = apiMap[0];\nvar browserApi = void 0;\n\n// determine the supported set of functions\nfor (var i = 0; i < apiMap.length; i++) {\n // check for exitFullscreen function\n if (apiMap[i][1] in document) {\n browserApi = apiMap[i];\n break;\n }\n}\n\n// map the browser API names to the spec API names\nif (browserApi) {\n for (var _i = 0; _i < browserApi.length; _i++) {\n FullscreenApi[specApi[_i]] = browserApi[_i];\n }\n}\n\n/**\n * @file media-error.js\n */\n/**\n * A Custom `MediaError` class which mimics the standard HTML5 `MediaError` class.\n *\n * @param {number|string|Object|MediaError} value\n * This can be of multiple types:\n * - number: should be a standard error code\n * - string: an error message (the code will be 0)\n * - Object: arbitrary properties\n * - `MediaError` (native): used to populate a video.js `MediaError` object\n * - `MediaError` (video.js): will return itself if it's already a\n * video.js `MediaError` object.\n *\n * @see [MediaError Spec]{@link https://dev.w3.org/html5/spec-author-view/video.html#mediaerror}\n * @see [Encrypted MediaError Spec]{@link https://www.w3.org/TR/2013/WD-encrypted-media-20130510/#error-codes}\n *\n * @class MediaError\n */\nfunction MediaError(value) {\n\n // Allow redundant calls to this constructor to avoid having `instanceof`\n // checks peppered around the code.\n if (value instanceof MediaError) {\n return value;\n }\n\n if (typeof value === 'number') {\n this.code = value;\n } else if (typeof value === 'string') {\n // default code is zero, so this is a custom error\n this.message = value;\n } else if (isObject(value)) {\n\n // We assign the `code` property manually because native `MediaError` objects\n // do not expose it as an own/enumerable property of the object.\n if (typeof value.code === 'number') {\n this.code = value.code;\n }\n\n assign(this, value);\n }\n\n if (!this.message) {\n this.message = MediaError.defaultMessages[this.code] || '';\n }\n}\n\n/**\n * The error code that refers two one of the defined `MediaError` types\n *\n * @type {Number}\n */\nMediaError.prototype.code = 0;\n\n/**\n * An optional message that to show with the error. Message is not part of the HTML5\n * video spec but allows for more informative custom errors.\n *\n * @type {String}\n */\nMediaError.prototype.message = '';\n\n/**\n * An optional status code that can be set by plugins to allow even more detail about\n * the error. For example a plugin might provide a specific HTTP status code and an\n * error message for that code. Then when the plugin gets that error this class will\n * know how to display an error message for it. This allows a custom message to show\n * up on the `Player` error overlay.\n *\n * @type {Array}\n */\nMediaError.prototype.status = null;\n\n/**\n * Errors indexed by the W3C standard. The order **CANNOT CHANGE**! See the\n * specification listed under {@link MediaError} for more information.\n *\n * @enum {array}\n * @readonly\n * @property {string} 0 - MEDIA_ERR_CUSTOM\n * @property {string} 1 - MEDIA_ERR_CUSTOM\n * @property {string} 2 - MEDIA_ERR_ABORTED\n * @property {string} 3 - MEDIA_ERR_NETWORK\n * @property {string} 4 - MEDIA_ERR_SRC_NOT_SUPPORTED\n * @property {string} 5 - MEDIA_ERR_ENCRYPTED\n */\nMediaError.errorTypes = ['MEDIA_ERR_CUSTOM', 'MEDIA_ERR_ABORTED', 'MEDIA_ERR_NETWORK', 'MEDIA_ERR_DECODE', 'MEDIA_ERR_SRC_NOT_SUPPORTED', 'MEDIA_ERR_ENCRYPTED'];\n\n/**\n * The default `MediaError` messages based on the {@link MediaError.errorTypes}.\n *\n * @type {Array}\n * @constant\n */\nMediaError.defaultMessages = {\n 1: 'You aborted the media playback',\n 2: 'A network error caused the media download to fail part-way.',\n 3: 'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.',\n 4: 'The media could not be loaded, either because the server or network failed or because the format is not supported.',\n 5: 'The media is encrypted and we do not have the keys to decrypt it.'\n};\n\n// Add types as properties on MediaError\n// e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4;\nfor (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {\n MediaError[MediaError.errorTypes[errNum]] = errNum;\n // values should be accessible on both the class and instance\n MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;\n}\n\n/**\n * Returns whether an object is `Promise`-like (i.e. has a `then` method).\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n *\n * @return {Boolean}\n * Whether or not the object is `Promise`-like.\n */\nfunction isPromise(value) {\n return value !== undefined && value !== null && typeof value.then === 'function';\n}\n\n/**\n * Silence a Promise-like object.\n *\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n */\nfunction silencePromise(value) {\n if (isPromise(value)) {\n value.then(null, function (e) {});\n }\n}\n\n/**\n * @file text-track-list-converter.js Utilities for capturing text track state and\n * re-creating tracks based on a capture.\n *\n * @module text-track-list-converter\n */\n\n/**\n * Examine a single {@link TextTrack} and return a JSON-compatible javascript object that\n * represents the {@link TextTrack}'s state.\n *\n * @param {TextTrack} track\n * The text track to query.\n *\n * @return {Object}\n * A serializable javascript representation of the TextTrack.\n * @private\n */\nvar trackToJson_ = function trackToJson_(track) {\n var ret = ['kind', 'label', 'language', 'id', 'inBandMetadataTrackDispatchType', 'mode', 'src'].reduce(function (acc, prop, i) {\n\n if (track[prop]) {\n acc[prop] = track[prop];\n }\n\n return acc;\n }, {\n cues: track.cues && Array.prototype.map.call(track.cues, function (cue) {\n return {\n startTime: cue.startTime,\n endTime: cue.endTime,\n text: cue.text,\n id: cue.id\n };\n })\n });\n\n return ret;\n};\n\n/**\n * Examine a {@link Tech} and return a JSON-compatible javascript array that represents the\n * state of all {@link TextTrack}s currently configured. The return array is compatible with\n * {@link text-track-list-converter:jsonToTextTracks}.\n *\n * @param {Tech} tech\n * The tech object to query\n *\n * @return {Array}\n * A serializable javascript representation of the {@link Tech}s\n * {@link TextTrackList}.\n */\nvar textTracksToJson = function textTracksToJson(tech) {\n\n var trackEls = tech.$$('track');\n\n var trackObjs = Array.prototype.map.call(trackEls, function (t) {\n return t.track;\n });\n var tracks = Array.prototype.map.call(trackEls, function (trackEl) {\n var json = trackToJson_(trackEl.track);\n\n if (trackEl.src) {\n json.src = trackEl.src;\n }\n return json;\n });\n\n return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function (track) {\n return trackObjs.indexOf(track) === -1;\n }).map(trackToJson_));\n};\n\n/**\n * Create a set of remote {@link TextTrack}s on a {@link Tech} based on an array of javascript\n * object {@link TextTrack} representations.\n *\n * @param {Array} json\n * An array of `TextTrack` representation objects, like those that would be\n * produced by `textTracksToJson`.\n *\n * @param {Tech} tech\n * The `Tech` to create the `TextTrack`s on.\n */\nvar jsonToTextTracks = function jsonToTextTracks(json, tech) {\n json.forEach(function (track) {\n var addedTrack = tech.addRemoteTextTrack(track).track;\n\n if (!track.src && track.cues) {\n track.cues.forEach(function (cue) {\n return addedTrack.addCue(cue);\n });\n }\n });\n\n return tech.textTracks();\n};\n\nvar textTrackConverter = { textTracksToJson: textTracksToJson, jsonToTextTracks: jsonToTextTracks, trackToJson_: trackToJson_ };\n\n/**\n * @file modal-dialog.js\n */\nvar MODAL_CLASS_NAME = 'vjs-modal-dialog';\nvar ESC = 27;\n\n/**\n * The `ModalDialog` displays over the video and its controls, which blocks\n * interaction with the player until it is closed.\n *\n * Modal dialogs include a \"Close\" button and will close when that button\n * is activated - or when ESC is pressed anywhere.\n *\n * @extends Component\n */\n\nvar ModalDialog = function (_Component) {\n inherits(ModalDialog, _Component);\n\n /**\n * Create an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Mixed} [options.content=undefined]\n * Provide customized content for this modal.\n *\n * @param {string} [options.description]\n * A text description for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.fillAlways=false]\n * Normally, modals are automatically filled only the first time\n * they open. This tells the modal to refresh its content\n * every time it opens.\n *\n * @param {string} [options.label]\n * A text label for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.temporary=true]\n * If `true`, the modal can only be opened once; it will be\n * disposed as soon as it's closed.\n *\n * @param {boolean} [options.uncloseable=false]\n * If `true`, the user will not be able to close the modal\n * through the UI in the normal ways. Programmatic closing is\n * still possible.\n */\n function ModalDialog(player, options) {\n classCallCheck(this, ModalDialog);\n\n var _this = possibleConstructorReturn(this, _Component.call(this, player, options));\n\n _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;\n\n _this.closeable(!_this.options_.uncloseable);\n _this.content(_this.options_.content);\n\n // Make sure the contentEl is defined AFTER any children are initialized\n // because we only want the contents of the modal in the contentEl\n // (not the UI elements like the close button).\n _this.contentEl_ = createEl('div', {\n className: MODAL_CLASS_NAME + '-content'\n }, {\n role: 'document'\n });\n\n _this.descEl_ = createEl('p', {\n className: MODAL_CLASS_NAME + '-description vjs-control-text',\n id: _this.el().getAttribute('aria-describedby')\n });\n\n textContent(_this.descEl_, _this.description());\n _this.el_.appendChild(_this.descEl_);\n _this.el_.appendChild(_this.contentEl_);\n return _this;\n }\n\n /**\n * Create the `ModalDialog`'s DOM element\n *\n * @return {Element}\n * The DOM element that gets created.\n */\n\n\n ModalDialog.prototype.createEl = function createEl$$1() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: this.buildCSSClass(),\n tabIndex: -1\n }, {\n 'aria-describedby': this.id() + '_description',\n 'aria-hidden': 'true',\n 'aria-label': this.label(),\n 'role': 'dialog'\n });\n };\n\n ModalDialog.prototype.dispose = function dispose() {\n this.contentEl_ = null;\n this.descEl_ = null;\n this.previouslyActiveEl_ = null;\n\n _Component.prototype.dispose.call(this);\n };\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n ModalDialog.prototype.buildCSSClass = function buildCSSClass() {\n return MODAL_CLASS_NAME + ' vjs-hidden ' + _Component.prototype.buildCSSClass.call(this);\n };\n\n /**\n * Handles `keydown` events on the document, looking for ESC, which closes\n * the modal.\n *\n * @param {EventTarget~Event} e\n * The keypress that triggered this event.\n *\n * @listens keydown\n */\n\n\n ModalDialog.prototype.handleKeyPress = function handleKeyPress(e) {\n if (e.which === ESC && this.closeable()) {\n this.close();\n }\n };\n\n /**\n * Returns the label string for this modal. Primarily used for accessibility.\n *\n * @return {string}\n * the localized or raw label of this modal.\n */\n\n\n ModalDialog.prototype.label = function label() {\n return this.localize(this.options_.label || 'Modal Window');\n };\n\n /**\n * Returns the description string for this modal. Primarily used for\n * accessibility.\n *\n * @return {string}\n * The localized or raw description of this modal.\n */\n\n\n ModalDialog.prototype.description = function description() {\n var desc = this.options_.description || this.localize('This is a modal window.');\n\n // Append a universal closeability message if the modal is closeable.\n if (this.closeable()) {\n desc += ' ' + this.localize('This modal can be closed by pressing the Escape key or activating the close button.');\n }\n\n return desc;\n };\n\n /**\n * Opens the modal.\n *\n * @fires ModalDialog#beforemodalopen\n * @fires ModalDialog#modalopen\n */\n\n\n ModalDialog.prototype.open = function open() {\n if (!this.opened_) {\n var player = this.player();\n\n /**\n * Fired just before a `ModalDialog` is opened.\n *\n * @event ModalDialog#beforemodalopen\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalopen');\n this.opened_ = true;\n\n // Fill content if the modal has never opened before and\n // never been filled.\n if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {\n this.fill();\n }\n\n // If the player was playing, pause it and take note of its previously\n // playing state.\n this.wasPlaying_ = !player.paused();\n\n if (this.options_.pauseOnOpen && this.wasPlaying_) {\n player.pause();\n }\n\n if (this.closeable()) {\n this.on(this.el_.ownerDocument, 'keydown', bind(this, this.handleKeyPress));\n }\n\n // Hide controls and note if they were enabled.\n this.hadControls_ = player.controls();\n player.controls(false);\n\n this.show();\n this.conditionalFocus_();\n this.el().setAttribute('aria-hidden', 'false');\n\n /**\n * Fired just after a `ModalDialog` is opened.\n *\n * @event ModalDialog#modalopen\n * @type {EventTarget~Event}\n */\n this.trigger('modalopen');\n this.hasBeenOpened_ = true;\n }\n };\n\n /**\n * If the `ModalDialog` is currently open or closed.\n *\n * @param {boolean} [value]\n * If given, it will open (`true`) or close (`false`) the modal.\n *\n * @return {boolean}\n * the current open state of the modaldialog\n */\n\n\n ModalDialog.prototype.opened = function opened(value) {\n if (typeof value === 'boolean') {\n this[value ? 'open' : 'close']();\n }\n return this.opened_;\n };\n\n /**\n * Closes the modal, does nothing if the `ModalDialog` is\n * not open.\n *\n * @fires ModalDialog#beforemodalclose\n * @fires ModalDialog#modalclose\n */\n\n\n ModalDialog.prototype.close = function close() {\n if (!this.opened_) {\n return;\n }\n var player = this.player();\n\n /**\n * Fired just before a `ModalDialog` is closed.\n *\n * @event ModalDialog#beforemodalclose\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalclose');\n this.opened_ = false;\n\n if (this.wasPlaying_ && this.options_.pauseOnOpen) {\n player.play();\n }\n\n if (this.closeable()) {\n this.off(this.el_.ownerDocument, 'keydown', bind(this, this.handleKeyPress));\n }\n\n if (this.hadControls_) {\n player.controls(true);\n }\n\n this.hide();\n this.el().setAttribute('aria-hidden', 'true');\n\n /**\n * Fired just after a `ModalDialog` is closed.\n *\n * @event ModalDialog#modalclose\n * @type {EventTarget~Event}\n */\n this.trigger('modalclose');\n this.conditionalBlur_();\n\n if (this.options_.temporary) {\n this.dispose();\n }\n };\n\n /**\n * Check to see if the `ModalDialog` is closeable via the UI.\n *\n * @param {boolean} [value]\n * If given as a boolean, it will set the `closeable` option.\n *\n * @return {boolean}\n * Returns the final value of the closable option.\n */\n\n\n ModalDialog.prototype.closeable = function closeable(value) {\n if (typeof value === 'boolean') {\n var closeable = this.closeable_ = !!value;\n var close = this.getChild('closeButton');\n\n // If this is being made closeable and has no close button, add one.\n if (closeable && !close) {\n\n // The close button should be a child of the modal - not its\n // content element, so temporarily change the content element.\n var temp = this.contentEl_;\n\n this.contentEl_ = this.el_;\n close = this.addChild('closeButton', { controlText: 'Close Modal Dialog' });\n this.contentEl_ = temp;\n this.on(close, 'close', this.close);\n }\n\n // If this is being made uncloseable and has a close button, remove it.\n if (!closeable && close) {\n this.off(close, 'close', this.close);\n this.removeChild(close);\n close.dispose();\n }\n }\n return this.closeable_;\n };\n\n /**\n * Fill the modal's content element with the modal's \"content\" option.\n * The content element will be emptied before this change takes place.\n */\n\n\n ModalDialog.prototype.fill = function fill() {\n this.fillWith(this.content());\n };\n\n /**\n * Fill the modal's content element with arbitrary content.\n * The content element will be emptied before this change takes place.\n *\n * @fires ModalDialog#beforemodalfill\n * @fires ModalDialog#modalfill\n *\n * @param {Mixed} [content]\n * The same rules apply to this as apply to the `content` option.\n */\n\n\n ModalDialog.prototype.fillWith = function fillWith(content) {\n var contentEl = this.contentEl();\n var parentEl = contentEl.parentNode;\n var nextSiblingEl = contentEl.nextSibling;\n\n /**\n * Fired just before a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#beforemodalfill\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalfill');\n this.hasBeenFilled_ = true;\n\n // Detach the content element from the DOM before performing\n // manipulation to avoid modifying the live DOM multiple times.\n parentEl.removeChild(contentEl);\n this.empty();\n insertContent(contentEl, content);\n /**\n * Fired just after a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#modalfill\n * @type {EventTarget~Event}\n */\n this.trigger('modalfill');\n\n // Re-inject the re-filled content element.\n if (nextSiblingEl) {\n parentEl.insertBefore(contentEl, nextSiblingEl);\n } else {\n parentEl.appendChild(contentEl);\n }\n\n // make sure that the close button is last in the dialog DOM\n var closeButton = this.getChild('closeButton');\n\n if (closeButton) {\n parentEl.appendChild(closeButton.el_);\n }\n };\n\n /**\n * Empties the content element. This happens anytime the modal is filled.\n *\n * @fires ModalDialog#beforemodalempty\n * @fires ModalDialog#modalempty\n */\n\n\n ModalDialog.prototype.empty = function empty() {\n /**\n * Fired just before a `ModalDialog` is emptied.\n *\n * @event ModalDialog#beforemodalempty\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalempty');\n emptyEl(this.contentEl());\n\n /**\n * Fired just after a `ModalDialog` is emptied.\n *\n * @event ModalDialog#modalempty\n * @type {EventTarget~Event}\n */\n this.trigger('modalempty');\n };\n\n /**\n * Gets or sets the modal content, which gets normalized before being\n * rendered into the DOM.\n *\n * This does not update the DOM or fill the modal, but it is called during\n * that process.\n *\n * @param {Mixed} [value]\n * If defined, sets the internal content value to be used on the\n * next call(s) to `fill`. This value is normalized before being\n * inserted. To \"clear\" the internal content value, pass `null`.\n *\n * @return {Mixed}\n * The current content of the modal dialog\n */\n\n\n ModalDialog.prototype.content = function content(value) {\n if (typeof value !== 'undefined') {\n this.content_ = value;\n }\n return this.content_;\n };\n\n /**\n * conditionally focus the modal dialog if focus was previously on the player.\n *\n * @private\n */\n\n\n ModalDialog.prototype.conditionalFocus_ = function conditionalFocus_() {\n var activeEl = document.activeElement;\n var playerEl = this.player_.el_;\n\n this.previouslyActiveEl_ = null;\n\n if (playerEl.contains(activeEl) || playerEl === activeEl) {\n this.previouslyActiveEl_ = activeEl;\n\n this.focus();\n\n this.on(document, 'keydown', this.handleKeyDown);\n }\n };\n\n /**\n * conditionally blur the element and refocus the last focused element\n *\n * @private\n */\n\n\n ModalDialog.prototype.conditionalBlur_ = function conditionalBlur_() {\n if (this.previouslyActiveEl_) {\n this.previouslyActiveEl_.focus();\n this.previouslyActiveEl_ = null;\n }\n\n this.off(document, 'keydown', this.handleKeyDown);\n };\n\n /**\n * Keydown handler. Attached when modal is focused.\n *\n * @listens keydown\n */\n\n\n ModalDialog.prototype.handleKeyDown = function handleKeyDown(event) {\n // exit early if it isn't a tab key\n if (event.which !== 9) {\n return;\n }\n\n var focusableEls = this.focusableEls_();\n var activeEl = this.el_.querySelector(':focus');\n var focusIndex = void 0;\n\n for (var i = 0; i < focusableEls.length; i++) {\n if (activeEl === focusableEls[i]) {\n focusIndex = i;\n break;\n }\n }\n\n if (document.activeElement === this.el_) {\n focusIndex = 0;\n }\n\n if (event.shiftKey && focusIndex === 0) {\n focusableEls[focusableEls.length - 1].focus();\n event.preventDefault();\n } else if (!event.shiftKey && focusIndex === focusableEls.length - 1) {\n focusableEls[0].focus();\n event.preventDefault();\n }\n };\n\n /**\n * get all focusable elements\n *\n * @private\n */\n\n\n ModalDialog.prototype.focusableEls_ = function focusableEls_() {\n var allChildren = this.el_.querySelectorAll('*');\n\n return Array.prototype.filter.call(allChildren, function (child) {\n return (child instanceof window.HTMLAnchorElement || child instanceof window.HTMLAreaElement) && child.hasAttribute('href') || (child instanceof window.HTMLInputElement || child instanceof window.HTMLSelectElement || child instanceof window.HTMLTextAreaElement || child instanceof window.HTMLButtonElement) && !child.hasAttribute('disabled') || child instanceof window.HTMLIFrameElement || child instanceof window.HTMLObjectElement || child instanceof window.HTMLEmbedElement || child.hasAttribute('tabindex') && child.getAttribute('tabindex') !== -1 || child.hasAttribute('contenteditable');\n });\n };\n\n return ModalDialog;\n}(Component);\n\n/**\n * Default options for `ModalDialog` default options.\n *\n * @type {Object}\n * @private\n */\n\n\nModalDialog.prototype.options_ = {\n pauseOnOpen: true,\n temporary: true\n};\n\nComponent.registerComponent('ModalDialog', ModalDialog);\n\n/**\n * @file track-list.js\n */\n/**\n * Common functionaliy between {@link TextTrackList}, {@link AudioTrackList}, and\n * {@link VideoTrackList}\n *\n * @extends EventTarget\n */\n\nvar TrackList = function (_EventTarget) {\n inherits(TrackList, _EventTarget);\n\n /**\n * Create an instance of this class\n *\n * @param {Track[]} tracks\n * A list of tracks to initialize the list with.\n *\n * @param {Object} [list]\n * The child object with inheritance done manually for ie8.\n *\n * @abstract\n */\n function TrackList() {\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n var _ret;\n\n var list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n classCallCheck(this, TrackList);\n\n var _this = possibleConstructorReturn(this, _EventTarget.call(this));\n\n if (!list) {\n list = _this; // eslint-disable-line\n if (IS_IE8) {\n list = document.createElement('custom');\n for (var prop in TrackList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = TrackList.prototype[prop];\n }\n }\n }\n }\n\n list.tracks_ = [];\n\n /**\n * @memberof TrackList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n Object.defineProperty(list, 'length', {\n get: function get$$1() {\n return this.tracks_.length;\n }\n });\n\n for (var i = 0; i < tracks.length; i++) {\n list.addTrack(tracks[i]);\n }\n\n // must return the object, as for ie8 it will not be this\n // but a reference to a document object\n return _ret = list, possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a {@link Track} to the `TrackList`\n *\n * @param {Track} track\n * The audio, video, or text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n\n\n TrackList.prototype.addTrack = function addTrack(track) {\n var index = this.tracks_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get$$1() {\n return this.tracks_[index];\n }\n });\n }\n\n // Do not add duplicate tracks\n if (this.tracks_.indexOf(track) === -1) {\n this.tracks_.push(track);\n /**\n * Triggered when a track is added to a track list.\n *\n * @event TrackList#addtrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was added.\n */\n this.trigger({\n track: track,\n type: 'addtrack'\n });\n }\n };\n\n /**\n * Remove a {@link Track} from the `TrackList`\n *\n * @param {Track} rtrack\n * The audio, video, or text track to remove from the list.\n *\n * @fires TrackList#removetrack\n */\n\n\n TrackList.prototype.removeTrack = function removeTrack(rtrack) {\n var track = void 0;\n\n for (var i = 0, l = this.length; i < l; i++) {\n if (this[i] === rtrack) {\n track = this[i];\n if (track.off) {\n track.off();\n }\n\n this.tracks_.splice(i, 1);\n\n break;\n }\n }\n\n if (!track) {\n return;\n }\n\n /**\n * Triggered when a track is removed from track list.\n *\n * @event TrackList#removetrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was removed.\n */\n this.trigger({\n track: track,\n type: 'removetrack'\n });\n };\n\n /**\n * Get a Track from the TrackList by a tracks id\n *\n * @param {String} id - the id of the track to get\n * @method getTrackById\n * @return {Track}\n * @private\n */\n\n\n TrackList.prototype.getTrackById = function getTrackById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var track = this[i];\n\n if (track.id === id) {\n result = track;\n break;\n }\n }\n\n return result;\n };\n\n return TrackList;\n}(EventTarget);\n\n/**\n * Triggered when a different track is selected/enabled.\n *\n * @event TrackList#change\n * @type {EventTarget~Event}\n */\n\n/**\n * Events that can be called with on + eventName. See {@link EventHandler}.\n *\n * @property {Object} TrackList#allowedEvents_\n * @private\n */\n\n\nTrackList.prototype.allowedEvents_ = {\n change: 'change',\n addtrack: 'addtrack',\n removetrack: 'removetrack'\n};\n\n// emulate attribute EventHandler support to allow for feature detection\nfor (var event in TrackList.prototype.allowedEvents_) {\n TrackList.prototype['on' + event] = null;\n}\n\n/**\n * @file audio-track-list.js\n */\n/**\n * Anywhere we call this function we diverge from the spec\n * as we only support one enabled audiotrack at a time\n *\n * @param {AudioTrackList} list\n * list to work on\n *\n * @param {AudioTrack} track\n * The track to skip\n *\n * @private\n */\nvar disableOthers = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n }\n // another audio track is enabled, disable it\n list[i].enabled = false;\n }\n};\n\n/**\n * The current list of {@link AudioTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist}\n * @extends TrackList\n */\n\nvar AudioTrackList = function (_TrackList) {\n inherits(AudioTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {AudioTrack[]} [tracks=[]]\n * A list of `AudioTrack` to instantiate the list with.\n */\n function AudioTrackList() {\n var _this, _ret;\n\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n classCallCheck(this, AudioTrackList);\n\n var list = void 0;\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].enabled) {\n disableOthers(tracks, tracks[i]);\n break;\n }\n }\n\n // IE8 forces us to implement inheritance ourselves\n // as it does not support Object.defineProperty properly\n if (IS_IE8) {\n list = document.createElement('custom');\n for (var prop in TrackList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = TrackList.prototype[prop];\n }\n }\n for (var _prop in AudioTrackList.prototype) {\n if (_prop !== 'constructor') {\n list[_prop] = AudioTrackList.prototype[_prop];\n }\n }\n }\n\n list = (_this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);\n list.changing_ = false;\n\n return _ret = list, possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add an {@link AudioTrack} to the `AudioTrackList`.\n *\n * @param {AudioTrack} track\n * The AudioTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n\n\n AudioTrackList.prototype.addTrack = function addTrack(track) {\n var _this2 = this;\n\n if (track.enabled) {\n disableOthers(this, track);\n }\n\n _TrackList.prototype.addTrack.call(this, track);\n // native tracks don't have this\n if (!track.addEventListener) {\n return;\n }\n\n /**\n * @listens AudioTrack#enabledchange\n * @fires TrackList#change\n */\n track.addEventListener('enabledchange', function () {\n // when we are disabling other tracks (since we don't support\n // more than one track at a time) we will set changing_\n // to true so that we don't trigger additional change events\n if (_this2.changing_) {\n return;\n }\n _this2.changing_ = true;\n disableOthers(_this2, track);\n _this2.changing_ = false;\n _this2.trigger('change');\n });\n };\n\n return AudioTrackList;\n}(TrackList);\n\n/**\n * @file video-track-list.js\n */\n/**\n * Un-select all other {@link VideoTrack}s that are selected.\n *\n * @param {VideoTrackList} list\n * list to work on\n *\n * @param {VideoTrack} track\n * The track to skip\n *\n * @private\n */\nvar disableOthers$1 = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n }\n // another video track is enabled, disable it\n list[i].selected = false;\n }\n};\n\n/**\n * The current list of {@link VideoTrack} for a video.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist}\n * @extends TrackList\n */\n\nvar VideoTrackList = function (_TrackList) {\n inherits(VideoTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {VideoTrack[]} [tracks=[]]\n * A list of `VideoTrack` to instantiate the list with.\n */\n function VideoTrackList() {\n var _this, _ret;\n\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n classCallCheck(this, VideoTrackList);\n\n var list = void 0;\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].selected) {\n disableOthers$1(tracks, tracks[i]);\n break;\n }\n }\n\n // IE8 forces us to implement inheritance ourselves\n // as it does not support Object.defineProperty properly\n if (IS_IE8) {\n list = document.createElement('custom');\n for (var prop in TrackList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = TrackList.prototype[prop];\n }\n }\n for (var _prop in VideoTrackList.prototype) {\n if (_prop !== 'constructor') {\n list[_prop] = VideoTrackList.prototype[_prop];\n }\n }\n }\n\n list = (_this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);\n list.changing_ = false;\n\n /**\n * @member {number} VideoTrackList#selectedIndex\n * The current index of the selected {@link VideoTrack`}.\n */\n Object.defineProperty(list, 'selectedIndex', {\n get: function get$$1() {\n for (var _i = 0; _i < this.length; _i++) {\n if (this[_i].selected) {\n return _i;\n }\n }\n return -1;\n },\n set: function set$$1() {}\n });\n\n return _ret = list, possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a {@link VideoTrack} to the `VideoTrackList`.\n *\n * @param {VideoTrack} track\n * The VideoTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n\n\n VideoTrackList.prototype.addTrack = function addTrack(track) {\n var _this2 = this;\n\n if (track.selected) {\n disableOthers$1(this, track);\n }\n\n _TrackList.prototype.addTrack.call(this, track);\n // native tracks don't have this\n if (!track.addEventListener) {\n return;\n }\n\n /**\n * @listens VideoTrack#selectedchange\n * @fires TrackList#change\n */\n track.addEventListener('selectedchange', function () {\n if (_this2.changing_) {\n return;\n }\n _this2.changing_ = true;\n disableOthers$1(_this2, track);\n _this2.changing_ = false;\n _this2.trigger('change');\n });\n };\n\n return VideoTrackList;\n}(TrackList);\n\n/**\n * @file text-track-list.js\n */\n/**\n * The current list of {@link TextTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}\n * @extends TrackList\n */\n\nvar TextTrackList = function (_TrackList) {\n inherits(TextTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {TextTrack[]} [tracks=[]]\n * A list of `TextTrack` to instantiate the list with.\n */\n function TextTrackList() {\n var _this, _ret;\n\n var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n classCallCheck(this, TextTrackList);\n\n var list = void 0;\n\n // IE8 forces us to implement inheritance ourselves\n // as it does not support Object.defineProperty properly\n if (IS_IE8) {\n list = document.createElement('custom');\n for (var prop in TrackList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = TrackList.prototype[prop];\n }\n }\n for (var _prop in TextTrackList.prototype) {\n if (_prop !== 'constructor') {\n list[_prop] = TextTrackList.prototype[_prop];\n }\n }\n }\n\n list = (_this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);\n return _ret = list, possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a {@link TextTrack} to the `TextTrackList`\n *\n * @param {TextTrack} track\n * The text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n\n\n TextTrackList.prototype.addTrack = function addTrack(track) {\n _TrackList.prototype.addTrack.call(this, track);\n\n /**\n * @listens TextTrack#modechange\n * @fires TrackList#change\n */\n track.addEventListener('modechange', bind(this, function () {\n this.trigger('change');\n }));\n\n var nonLanguageTextTrackKind = ['metadata', 'chapters'];\n\n if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {\n track.addEventListener('modechange', bind(this, function () {\n this.trigger('selectedlanguagechange');\n }));\n }\n };\n\n return TextTrackList;\n}(TrackList);\n\n/**\n * @file html-track-element-list.js\n */\n\n/**\n * The current list of {@link HtmlTrackElement}s.\n */\n\nvar HtmlTrackElementList = function () {\n\n /**\n * Create an instance of this class.\n *\n * @param {HtmlTrackElement[]} [tracks=[]]\n * A list of `HtmlTrackElement` to instantiate the list with.\n */\n function HtmlTrackElementList() {\n var trackElements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n classCallCheck(this, HtmlTrackElementList);\n\n var list = this; // eslint-disable-line\n\n if (IS_IE8) {\n list = document.createElement('custom');\n\n for (var prop in HtmlTrackElementList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = HtmlTrackElementList.prototype[prop];\n }\n }\n }\n\n list.trackElements_ = [];\n\n /**\n * @memberof HtmlTrackElementList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n Object.defineProperty(list, 'length', {\n get: function get$$1() {\n return this.trackElements_.length;\n }\n });\n\n for (var i = 0, length = trackElements.length; i < length; i++) {\n list.addTrackElement_(trackElements[i]);\n }\n\n if (IS_IE8) {\n return list;\n }\n }\n\n /**\n * Add an {@link HtmlTrackElement} to the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to add to the list.\n *\n * @private\n */\n\n\n HtmlTrackElementList.prototype.addTrackElement_ = function addTrackElement_(trackElement) {\n var index = this.trackElements_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get$$1() {\n return this.trackElements_[index];\n }\n });\n }\n\n // Do not add duplicate elements\n if (this.trackElements_.indexOf(trackElement) === -1) {\n this.trackElements_.push(trackElement);\n }\n };\n\n /**\n * Get an {@link HtmlTrackElement} from the `HtmlTrackElementList` given an\n * {@link TextTrack}.\n *\n * @param {TextTrack} track\n * The track associated with a track element.\n *\n * @return {HtmlTrackElement|undefined}\n * The track element that was found or undefined.\n *\n * @private\n */\n\n\n HtmlTrackElementList.prototype.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {\n var trackElement_ = void 0;\n\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (track === this.trackElements_[i].track) {\n trackElement_ = this.trackElements_[i];\n\n break;\n }\n }\n\n return trackElement_;\n };\n\n /**\n * Remove a {@link HtmlTrackElement} from the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to remove from the list.\n *\n * @private\n */\n\n\n HtmlTrackElementList.prototype.removeTrackElement_ = function removeTrackElement_(trackElement) {\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (trackElement === this.trackElements_[i]) {\n this.trackElements_.splice(i, 1);\n\n break;\n }\n }\n };\n\n return HtmlTrackElementList;\n}();\n\n/**\n * @file text-track-cue-list.js\n */\n/**\n * @typedef {Object} TextTrackCueList~TextTrackCue\n *\n * @property {string} id\n * The unique id for this text track cue\n *\n * @property {number} startTime\n * The start time for this text track cue\n *\n * @property {number} endTime\n * The end time for this text track cue\n *\n * @property {boolean} pauseOnExit\n * Pause when the end time is reached if true.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue}\n */\n\n/**\n * A List of TextTrackCues.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist}\n */\n\nvar TextTrackCueList = function () {\n\n /**\n * Create an instance of this class..\n *\n * @param {Array} cues\n * A list of cues to be initialized with\n */\n function TextTrackCueList(cues) {\n classCallCheck(this, TextTrackCueList);\n\n var list = this; // eslint-disable-line\n\n if (IS_IE8) {\n list = document.createElement('custom');\n\n for (var prop in TextTrackCueList.prototype) {\n if (prop !== 'constructor') {\n list[prop] = TextTrackCueList.prototype[prop];\n }\n }\n }\n\n TextTrackCueList.prototype.setCues_.call(list, cues);\n\n /**\n * @memberof TextTrackCueList\n * @member {number} length\n * The current number of `TextTrackCue`s in the TextTrackCueList.\n * @instance\n */\n Object.defineProperty(list, 'length', {\n get: function get$$1() {\n return this.length_;\n }\n });\n\n if (IS_IE8) {\n return list;\n }\n }\n\n /**\n * A setter for cues in this list. Creates getters\n * an an index for the cues.\n *\n * @param {Array} cues\n * An array of cues to set\n *\n * @private\n */\n\n\n TextTrackCueList.prototype.setCues_ = function setCues_(cues) {\n var oldLength = this.length || 0;\n var i = 0;\n var l = cues.length;\n\n this.cues_ = cues;\n this.length_ = cues.length;\n\n var defineProp = function defineProp(index) {\n if (!('' + index in this)) {\n Object.defineProperty(this, '' + index, {\n get: function get$$1() {\n return this.cues_[index];\n }\n });\n }\n };\n\n if (oldLength < l) {\n i = oldLength;\n\n for (; i < l; i++) {\n defineProp.call(this, i);\n }\n }\n };\n\n /**\n * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id.\n *\n * @param {string} id\n * The id of the cue that should be searched for.\n *\n * @return {TextTrackCueList~TextTrackCue|null}\n * A single cue or null if none was found.\n */\n\n\n TextTrackCueList.prototype.getCueById = function getCueById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var cue = this[i];\n\n if (cue.id === id) {\n result = cue;\n break;\n }\n }\n\n return result;\n };\n\n return TextTrackCueList;\n}();\n\n/**\n * @file track-kinds.js\n */\n\n/**\n * All possible `VideoTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind\n * @typedef VideoTrack~Kind\n * @enum\n */\nvar VideoTrackKind = {\n alternative: 'alternative',\n captions: 'captions',\n main: 'main',\n sign: 'sign',\n subtitles: 'subtitles',\n commentary: 'commentary'\n};\n\n/**\n * All possible `AudioTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind\n * @typedef AudioTrack~Kind\n * @enum\n */\nvar AudioTrackKind = {\n 'alternative': 'alternative',\n 'descriptions': 'descriptions',\n 'main': 'main',\n 'main-desc': 'main-desc',\n 'translation': 'translation',\n 'commentary': 'commentary'\n};\n\n/**\n * All possible `TextTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-kind\n * @typedef TextTrack~Kind\n * @enum\n */\nvar TextTrackKind = {\n subtitles: 'subtitles',\n captions: 'captions',\n descriptions: 'descriptions',\n chapters: 'chapters',\n metadata: 'metadata'\n};\n\n/**\n * All possible `TextTrackMode`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode\n * @typedef TextTrack~Mode\n * @enum\n */\nvar TextTrackMode = {\n disabled: 'disabled',\n hidden: 'hidden',\n showing: 'showing'\n};\n\n/**\n * @file track.js\n */\n/**\n * A Track class that contains all of the common functionality for {@link AudioTrack},\n * {@link VideoTrack}, and {@link TextTrack}.\n *\n * > Note: This class should not be used directly\n *\n * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html}\n * @extends EventTarget\n * @abstract\n */\n\nvar Track = function (_EventTarget) {\n inherits(Track, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid kind for the track type you are creating.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @abstract\n */\n function Track() {\n var _ret;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n classCallCheck(this, Track);\n\n var _this = possibleConstructorReturn(this, _EventTarget.call(this));\n\n var track = _this; // eslint-disable-line\n\n if (IS_IE8) {\n track = document.createElement('custom');\n for (var prop in Track.prototype) {\n if (prop !== 'constructor') {\n track[prop] = Track.prototype[prop];\n }\n }\n }\n\n var trackProps = {\n id: options.id || 'vjs_track_' + newGUID(),\n kind: options.kind || '',\n label: options.label || '',\n language: options.language || ''\n };\n\n /**\n * @memberof Track\n * @member {string} id\n * The id of this track. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} kind\n * The kind of track that this is. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} label\n * The label of this track. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} language\n * The two letter language code for this track. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n\n var _loop = function _loop(key) {\n Object.defineProperty(track, key, {\n get: function get$$1() {\n return trackProps[key];\n },\n set: function set$$1() {}\n });\n };\n\n for (var key in trackProps) {\n _loop(key);\n }\n\n return _ret = track, possibleConstructorReturn(_this, _ret);\n }\n\n return Track;\n}(EventTarget);\n\n/**\n * @file url.js\n * @module url\n */\n/**\n * @typedef {Object} url:URLObject\n *\n * @property {string} protocol\n * The protocol of the url that was parsed.\n *\n * @property {string} hostname\n * The hostname of the url that was parsed.\n *\n * @property {string} port\n * The port of the url that was parsed.\n *\n * @property {string} pathname\n * The pathname of the url that was parsed.\n *\n * @property {string} search\n * The search query of the url that was parsed.\n *\n * @property {string} hash\n * The hash of the url that was parsed.\n *\n * @property {string} host\n * The host of the url that was parsed.\n */\n\n/**\n * Resolve and parse the elements of a URL.\n *\n * @param {String} url\n * The url to parse\n *\n * @return {url:URLObject}\n * An object of url details\n */\nvar parseUrl = function parseUrl(url) {\n var props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host'];\n\n // add the url to an anchor and let the browser parse the URL\n var a = document.createElement('a');\n\n a.href = url;\n\n // IE8 (and 9?) Fix\n // ie8 doesn't parse the URL correctly until the anchor is actually\n // added to the body, and an innerHTML is needed to trigger the parsing\n var addToBody = a.host === '' && a.protocol !== 'file:';\n var div = void 0;\n\n if (addToBody) {\n div = document.createElement('div');\n div.innerHTML = '';\n a = div.firstChild;\n // prevent the div from affecting layout\n div.setAttribute('style', 'display:none; position:absolute;');\n document.body.appendChild(div);\n }\n\n // Copy the specific URL properties to a new object\n // This is also needed for IE8 because the anchor loses its\n // properties when it's removed from the dom\n var details = {};\n\n for (var i = 0; i < props.length; i++) {\n details[props[i]] = a[props[i]];\n }\n\n // IE9 adds the port to the host property unlike everyone else. If\n // a port identifier is added for standard ports, strip it.\n if (details.protocol === 'http:') {\n details.host = details.host.replace(/:80$/, '');\n }\n\n if (details.protocol === 'https:') {\n details.host = details.host.replace(/:443$/, '');\n }\n\n if (!details.protocol) {\n details.protocol = window.location.protocol;\n }\n\n if (addToBody) {\n document.body.removeChild(div);\n }\n\n return details;\n};\n\n/**\n * Get absolute version of relative URL. Used to tell flash correct URL.\n *\n *\n * @param {string} url\n * URL to make absolute\n *\n * @return {string}\n * Absolute URL\n *\n * @see http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue\n */\nvar getAbsoluteURL = function getAbsoluteURL(url) {\n // Check if absolute URL\n if (!url.match(/^https?:\\/\\//)) {\n // Convert to absolute URL. Flash hosted off-site needs an absolute URL.\n var div = document.createElement('div');\n\n div.innerHTML = 'x';\n url = div.firstChild.href;\n }\n\n return url;\n};\n\n/**\n * Returns the extension of the passed file name. It will return an empty string\n * if passed an invalid path.\n *\n * @param {string} path\n * The fileName path like '/path/to/file.mp4'\n *\n * @returns {string}\n * The extension in lower case or an empty string if no\n * extension could be found.\n */\nvar getFileExtension = function getFileExtension(path) {\n if (typeof path === 'string') {\n var splitPathRe = /^(\\/?)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?)(\\.([^\\.\\/\\?]+)))(?:[\\/]*|[\\?].*)$/i;\n var pathParts = splitPathRe.exec(path);\n\n if (pathParts) {\n return pathParts.pop().toLowerCase();\n }\n }\n\n return '';\n};\n\n/**\n * Returns whether the url passed is a cross domain request or not.\n *\n * @param {string} url\n * The url to check.\n *\n * @return {boolean}\n * Whether it is a cross domain request or not.\n */\nvar isCrossOrigin = function isCrossOrigin(url) {\n var winLoc = window.location;\n var urlInfo = parseUrl(url);\n\n // IE8 protocol relative urls will return ':' for protocol\n var srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol;\n\n // Check if url is for another domain/origin\n // IE8 doesn't know location.origin, so we won't rely on it here\n var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;\n\n return crossOrigin;\n};\n\nvar Url = (Object.freeze || Object)({\n\tparseUrl: parseUrl,\n\tgetAbsoluteURL: getAbsoluteURL,\n\tgetFileExtension: getFileExtension,\n\tisCrossOrigin: isCrossOrigin\n});\n\n/**\n * @file text-track.js\n */\n/**\n * Takes a webvtt file contents and parses it into cues\n *\n * @param {string} srcContent\n * webVTT file contents\n *\n * @param {TextTrack} track\n * TextTrack to add cues to. Cues come from the srcContent.\n *\n * @private\n */\nvar parseCues = function parseCues(srcContent, track) {\n var parser = new window.WebVTT.Parser(window, window.vttjs, window.WebVTT.StringDecoder());\n var errors = [];\n\n parser.oncue = function (cue) {\n track.addCue(cue);\n };\n\n parser.onparsingerror = function (error) {\n errors.push(error);\n };\n\n parser.onflush = function () {\n track.trigger({\n type: 'loadeddata',\n target: track\n });\n };\n\n parser.parse(srcContent);\n if (errors.length > 0) {\n if (window.console && window.console.groupCollapsed) {\n window.console.groupCollapsed('Text Track parsing errors for ' + track.src);\n }\n errors.forEach(function (error) {\n return log.error(error);\n });\n if (window.console && window.console.groupEnd) {\n window.console.groupEnd();\n }\n }\n\n parser.flush();\n};\n\n/**\n * Load a `TextTrack` from a specifed url.\n *\n * @param {string} src\n * Url to load track from.\n *\n * @param {TextTrack} track\n * Track to add cues to. Comes from the content at the end of `url`.\n *\n * @private\n */\nvar loadTrack = function loadTrack(src, track) {\n var opts = {\n uri: src\n };\n var crossOrigin = isCrossOrigin(src);\n\n if (crossOrigin) {\n opts.cors = crossOrigin;\n }\n\n xhr(opts, bind(this, function (err, response, responseBody) {\n if (err) {\n return log.error(err, response);\n }\n\n track.loaded_ = true;\n\n // Make sure that vttjs has loaded, otherwise, wait till it finished loading\n // NOTE: this is only used for the alt/video.novtt.js build\n if (typeof window.WebVTT !== 'function') {\n if (track.tech_) {\n var loadHandler = function loadHandler() {\n return parseCues(responseBody, track);\n };\n\n track.tech_.on('vttjsloaded', loadHandler);\n track.tech_.on('vttjserror', function () {\n log.error('vttjs failed to load, stopping trying to process ' + track.src);\n track.tech_.off('vttjsloaded', loadHandler);\n });\n }\n } else {\n parseCues(responseBody, track);\n }\n }));\n};\n\n/**\n * A representation of a single `TextTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack}\n * @extends Track\n */\n\nvar TextTrack = function (_Track) {\n inherits(TextTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this TextTrack.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * vesion of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function TextTrack() {\n var _this, _ret;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n classCallCheck(this, TextTrack);\n\n if (!options.tech) {\n throw new Error('A tech was not provided.');\n }\n\n var settings = mergeOptions(options, {\n kind: TextTrackKind[options.kind] || 'subtitles',\n language: options.language || options.srclang || ''\n });\n var mode = TextTrackMode[settings.mode] || 'disabled';\n var default_ = settings['default'];\n\n if (settings.kind === 'metadata' || settings.kind === 'chapters') {\n mode = 'hidden';\n }\n // on IE8 this will be a document element\n // for every other browser this will be a normal object\n var tt = (_this = possibleConstructorReturn(this, _Track.call(this, settings)), _this);\n\n tt.tech_ = settings.tech;\n\n if (IS_IE8) {\n for (var prop in TextTrack.prototype) {\n if (prop !== 'constructor') {\n tt[prop] = TextTrack.prototype[prop];\n }\n }\n }\n\n tt.cues_ = [];\n tt.activeCues_ = [];\n\n var cues = new TextTrackCueList(tt.cues_);\n var activeCues = new TextTrackCueList(tt.activeCues_);\n var changed = false;\n var timeupdateHandler = bind(tt, function () {\n\n // Accessing this.activeCues for the side-effects of updating itself\n // due to it's nature as a getter function. Do not remove or cues will\n // stop updating!\n // Use the setter to prevent deletion from uglify (pure_getters rule)\n this.activeCues = this.activeCues;\n if (changed) {\n this.trigger('cuechange');\n changed = false;\n }\n });\n\n if (mode !== 'disabled') {\n tt.tech_.ready(function () {\n tt.tech_.on('timeupdate', timeupdateHandler);\n }, true);\n }\n\n /**\n * @memberof TextTrack\n * @member {boolean} default\n * If this track was set to be on or off by default. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n Object.defineProperty(tt, 'default', {\n get: function get$$1() {\n return default_;\n },\n set: function set$$1() {}\n });\n\n /**\n * @memberof TextTrack\n * @member {string} mode\n * Set the mode of this TextTrack to a valid {@link TextTrack~Mode}. Will\n * not be set if setting to an invalid mode.\n * @instance\n *\n * @fires TextTrack#modechange\n */\n Object.defineProperty(tt, 'mode', {\n get: function get$$1() {\n return mode;\n },\n set: function set$$1(newMode) {\n var _this2 = this;\n\n if (!TextTrackMode[newMode]) {\n return;\n }\n mode = newMode;\n if (mode !== 'disabled') {\n\n this.tech_.ready(function () {\n _this2.tech_.on('timeupdate', timeupdateHandler);\n }, true);\n } else {\n this.tech_.off('timeupdate', timeupdateHandler);\n }\n /**\n * An event that fires when mode changes on this track. This allows\n * the TextTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec!\n *\n * @event TextTrack#modechange\n * @type {EventTarget~Event}\n */\n this.trigger('modechange');\n }\n });\n\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} cues\n * The text track cue list for this TextTrack.\n * @instance\n */\n Object.defineProperty(tt, 'cues', {\n get: function get$$1() {\n if (!this.loaded_) {\n return null;\n }\n\n return cues;\n },\n set: function set$$1() {}\n });\n\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} activeCues\n * The list text track cues that are currently active for this TextTrack.\n * @instance\n */\n Object.defineProperty(tt, 'activeCues', {\n get: function get$$1() {\n if (!this.loaded_) {\n return null;\n }\n\n // nothing to do\n if (this.cues.length === 0) {\n return activeCues;\n }\n\n var ct = this.tech_.currentTime();\n var active = [];\n\n for (var i = 0, l = this.cues.length; i < l; i++) {\n var cue = this.cues[i];\n\n if (cue.startTime <= ct && cue.endTime >= ct) {\n active.push(cue);\n } else if (cue.startTime === cue.endTime && cue.startTime <= ct && cue.startTime + 0.5 >= ct) {\n active.push(cue);\n }\n }\n\n changed = false;\n\n if (active.length !== this.activeCues_.length) {\n changed = true;\n } else {\n for (var _i = 0; _i < active.length; _i++) {\n if (this.activeCues_.indexOf(active[_i]) === -1) {\n changed = true;\n }\n }\n }\n\n this.activeCues_ = active;\n activeCues.setCues_(this.activeCues_);\n\n return activeCues;\n },\n\n\n // /!\\ Keep this setter empty (see the timeupdate handler above)\n set: function set$$1() {}\n });\n\n if (settings.src) {\n tt.src = settings.src;\n loadTrack(settings.src, tt);\n } else {\n tt.loaded_ = true;\n }\n\n return _ret = tt, possibleConstructorReturn(_this, _ret);\n }\n\n /**\n * Add a cue to the internal list of cues.\n *\n * @param {TextTrack~Cue} cue\n * The cue to add to our internal list\n */\n\n\n TextTrack.prototype.addCue = function addCue(originalCue) {\n var cue = originalCue;\n\n if (window.vttjs && !(originalCue instanceof window.vttjs.VTTCue)) {\n cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);\n\n for (var prop in originalCue) {\n if (!(prop in cue)) {\n cue[prop] = originalCue[prop];\n }\n }\n\n // make sure that `id` is copied over\n cue.id = originalCue.id;\n cue.originalCue_ = originalCue;\n }\n\n var tracks = this.tech_.textTracks();\n\n for (var i = 0; i < tracks.length; i++) {\n if (tracks[i] !== this) {\n tracks[i].removeCue(cue);\n }\n }\n\n this.cues_.push(cue);\n this.cues.setCues_(this.cues_);\n };\n\n /**\n * Remove a cue from our internal list\n *\n * @param {TextTrack~Cue} removeCue\n * The cue to remove from our internal list\n */\n\n\n TextTrack.prototype.removeCue = function removeCue(_removeCue) {\n var i = this.cues_.length;\n\n while (i--) {\n var cue = this.cues_[i];\n\n if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) {\n this.cues_.splice(i, 1);\n this.cues.setCues_(this.cues_);\n break;\n }\n }\n };\n\n return TextTrack;\n}(Track);\n\n/**\n * cuechange - One or more cues in the track have become active or stopped being active.\n */\n\n\nTextTrack.prototype.allowedEvents_ = {\n cuechange: 'cuechange'\n};\n\n/**\n * A representation of a single `AudioTrack`. If it is part of an {@link AudioTrackList}\n * only one `AudioTrack` in the list will be enabled at a time.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack}\n * @extends Track\n */\n\nvar AudioTrack = function (_Track) {\n inherits(AudioTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {AudioTrack~Kind} [options.kind='']\n * A valid audio track kind\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.enabled]\n * If this track is the one that is currently playing. If this track is part of\n * an {@link AudioTrackList}, only one {@link AudioTrack} will be enabled.\n */\n function AudioTrack() {\n var _this, _ret;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n classCallCheck(this, AudioTrack);\n\n var settings = mergeOptions(options, {\n kind: AudioTrackKind[options.kind] || ''\n });\n // on IE8 this will be a document element\n // for every other browser this will be a normal object\n var track = (_this = possibleConstructorReturn(this, _Track.call(this, settings)), _this);\n var enabled = false;\n\n if (IS_IE8) {\n for (var prop in AudioTrack.prototype) {\n if (prop !== 'constructor') {\n track[prop] = AudioTrack.prototype[prop];\n }\n }\n }\n /**\n * @memberof AudioTrack\n * @member {boolean} enabled\n * If this `AudioTrack` is enabled or not. When setting this will\n * fire {@link AudioTrack#enabledchange} if the state of enabled is changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n Object.defineProperty(track, 'enabled', {\n get: function get$$1() {\n return enabled;\n },\n set: function set$$1(newEnabled) {\n // an invalid or unchanged value\n if (typeof newEnabled !== 'boolean' || newEnabled === enabled) {\n return;\n }\n enabled = newEnabled;\n\n /**\n * An event that fires when enabled changes on this track. This allows\n * the AudioTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event AudioTrack#enabledchange\n * @type {EventTarget~Event}\n */\n this.trigger('enabledchange');\n }\n });\n\n // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n if (settings.enabled) {\n track.enabled = settings.enabled;\n }\n track.loaded_ = true;\n\n return _ret = track, possibleConstructorReturn(_this, _ret);\n }\n\n return AudioTrack;\n}(Track);\n\n/**\n * A representation of a single `VideoTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotrack}\n * @extends Track\n */\n\nvar VideoTrack = function (_Track) {\n inherits(VideoTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid {@link VideoTrack~Kind}\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.selected]\n * If this track is the one that is currently playing.\n */\n function VideoTrack() {\n var _this, _ret;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n classCallCheck(this, VideoTrack);\n\n var settings = mergeOptions(options, {\n kind: VideoTrackKind[options.kind] || ''\n });\n\n // on IE8 this will be a document element\n // for every other browser this will be a normal object\n var track = (_this = possibleConstructorReturn(this, _Track.call(this, settings)), _this);\n var selected = false;\n\n if (IS_IE8) {\n for (var prop in VideoTrack.prototype) {\n if (prop !== 'constructor') {\n track[prop] = VideoTrack.prototype[prop];\n }\n }\n }\n\n /**\n * @memberof VideoTrack\n * @member {boolean} selected\n * If this `VideoTrack` is selected or not. When setting this will\n * fire {@link VideoTrack#selectedchange} if the state of selected changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n Object.defineProperty(track, 'selected', {\n get: function get$$1() {\n return selected;\n },\n set: function set$$1(newSelected) {\n // an invalid or unchanged value\n if (typeof newSelected !== 'boolean' || newSelected === selected) {\n return;\n }\n selected = newSelected;\n\n /**\n * An event that fires when selected changes on this track. This allows\n * the VideoTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event VideoTrack#selectedchange\n * @type {EventTarget~Event}\n */\n this.trigger('selectedchange');\n }\n });\n\n // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n if (settings.selected) {\n track.selected = settings.selected;\n }\n\n return _ret = track, possibleConstructorReturn(_this, _ret);\n }\n\n return VideoTrack;\n}(Track);\n\n/**\n * @file html-track-element.js\n */\n\n/**\n * @memberof HTMLTrackElement\n * @typedef {HTMLTrackElement~ReadyState}\n * @enum {number}\n */\nvar NONE = 0;\nvar LOADING = 1;\nvar LOADED = 2;\nvar ERROR = 3;\n\n/**\n * A single track represented in the DOM.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement}\n * @extends EventTarget\n */\n\nvar HTMLTrackElement = function (_EventTarget) {\n inherits(HTMLTrackElement, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this HTMLTrackElement.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * vesion of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function HTMLTrackElement() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n classCallCheck(this, HTMLTrackElement);\n\n var _this = possibleConstructorReturn(this, _EventTarget.call(this));\n\n var readyState = void 0;\n var trackElement = _this; // eslint-disable-line\n\n if (IS_IE8) {\n trackElement = document.createElement('custom');\n\n for (var prop in HTMLTrackElement.prototype) {\n if (prop !== 'constructor') {\n trackElement[prop] = HTMLTrackElement.prototype[prop];\n }\n }\n }\n\n var track = new TextTrack(options);\n\n trackElement.kind = track.kind;\n trackElement.src = track.src;\n trackElement.srclang = track.language;\n trackElement.label = track.label;\n trackElement['default'] = track['default'];\n\n /**\n * @memberof HTMLTrackElement\n * @member {HTMLTrackElement~ReadyState} readyState\n * The current ready state of the track element.\n * @instance\n */\n Object.defineProperty(trackElement, 'readyState', {\n get: function get$$1() {\n return readyState;\n }\n });\n\n /**\n * @memberof HTMLTrackElement\n * @member {TextTrack} track\n * The underlying TextTrack object.\n * @instance\n *\n */\n Object.defineProperty(trackElement, 'track', {\n get: function get$$1() {\n return track;\n }\n });\n\n readyState = NONE;\n\n /**\n * @listens TextTrack#loadeddata\n * @fires HTMLTrackElement#load\n */\n track.addEventListener('loadeddata', function () {\n readyState = LOADED;\n\n trackElement.trigger({\n type: 'load',\n target: trackElement\n });\n });\n\n if (IS_IE8) {\n var _ret;\n\n return _ret = trackElement, possibleConstructorReturn(_this, _ret);\n }\n return _this;\n }\n\n return HTMLTrackElement;\n}(EventTarget);\n\nHTMLTrackElement.prototype.allowedEvents_ = {\n load: 'load'\n};\n\nHTMLTrackElement.NONE = NONE;\nHTMLTrackElement.LOADING = LOADING;\nHTMLTrackElement.LOADED = LOADED;\nHTMLTrackElement.ERROR = ERROR;\n\n/*\n * This file contains all track properties that are used in\n * player.js, tech.js, html5.js and possibly other techs in the future.\n */\n\nvar NORMAL = {\n audio: {\n ListClass: AudioTrackList,\n TrackClass: AudioTrack,\n capitalName: 'Audio'\n },\n video: {\n ListClass: VideoTrackList,\n TrackClass: VideoTrack,\n capitalName: 'Video'\n },\n text: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'Text'\n }\n};\n\nObject.keys(NORMAL).forEach(function (type) {\n NORMAL[type].getterName = type + 'Tracks';\n NORMAL[type].privateName = type + 'Tracks_';\n});\n\nvar REMOTE = {\n remoteText: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'RemoteText',\n getterName: 'remoteTextTracks',\n privateName: 'remoteTextTracks_'\n },\n remoteTextEl: {\n ListClass: HtmlTrackElementList,\n TrackClass: HTMLTrackElement,\n capitalName: 'RemoteTextTrackEls',\n getterName: 'remoteTextTrackEls',\n privateName: 'remoteTextTrackEls_'\n }\n};\n\nvar ALL = mergeOptions(NORMAL, REMOTE);\n\nREMOTE.names = Object.keys(REMOTE);\nNORMAL.names = Object.keys(NORMAL);\nALL.names = [].concat(REMOTE.names).concat(NORMAL.names);\n\n/**\n * @file tech.js\n */\n\n/**\n * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string\n * that just contains the src url alone.\n * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};`\n * `var SourceString = 'http://example.com/some-video.mp4';`\n *\n * @typedef {Object|string} Tech~SourceObject\n *\n * @property {string} src\n * The url to the source\n *\n * @property {string} type\n * The mime type of the source\n */\n\n/**\n * A function used by {@link Tech} to create a new {@link TextTrack}.\n *\n * @private\n *\n * @param {Tech} self\n * An instance of the Tech class.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @param {Object} [options={}]\n * An object with additional text track options\n *\n * @return {TextTrack}\n * The text track that was created.\n */\nfunction createTrackHelper(self, kind, label, language) {\n var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n\n var tracks = self.textTracks();\n\n options.kind = kind;\n\n if (label) {\n options.label = label;\n }\n if (language) {\n options.language = language;\n }\n options.tech = self;\n\n var track = new ALL.text.TrackClass(options);\n\n tracks.addTrack(track);\n\n return track;\n}\n\n/**\n * This is the base class for media playback technology controllers, such as\n * {@link Flash} and {@link HTML5}\n *\n * @extends Component\n */\n\nvar Tech = function (_Component) {\n inherits(Tech, _Component);\n\n /**\n * Create an instance of this Tech.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} ready\n * Callback function to call when the `HTML5` Tech is ready.\n */\n function Tech() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var ready = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n classCallCheck(this, Tech);\n\n // we don't want the tech to report user activity automatically.\n // This is done manually in addControlsListeners\n options.reportTouchActivity = false;\n\n // keep track of whether the current source has played at all to\n // implement a very limited played()\n var _this = possibleConstructorReturn(this, _Component.call(this, null, options, ready));\n\n _this.hasStarted_ = false;\n _this.on('playing', function () {\n this.hasStarted_ = true;\n });\n _this.on('loadstart', function () {\n this.hasStarted_ = false;\n });\n\n ALL.names.forEach(function (name) {\n var props = ALL[name];\n\n if (options && options[props.getterName]) {\n _this[props.privateName] = options[props.getterName];\n }\n });\n\n // Manually track progress in cases where the browser/flash player doesn't report it.\n if (!_this.featuresProgressEvents) {\n _this.manualProgressOn();\n }\n\n // Manually track timeupdates in cases where the browser/flash player doesn't report it.\n if (!_this.featuresTimeupdateEvents) {\n _this.manualTimeUpdatesOn();\n }\n\n ['Text', 'Audio', 'Video'].forEach(function (track) {\n if (options['native' + track + 'Tracks'] === false) {\n _this['featuresNative' + track + 'Tracks'] = false;\n }\n });\n\n if (options.nativeCaptions === false || options.nativeTextTracks === false) {\n _this.featuresNativeTextTracks = false;\n } else if (options.nativeCaptions === true || options.nativeTextTracks === true) {\n _this.featuresNativeTextTracks = true;\n }\n\n if (!_this.featuresNativeTextTracks) {\n _this.emulateTextTracks();\n }\n\n _this.autoRemoteTextTracks_ = new ALL.text.ListClass();\n\n _this.initTrackListeners();\n\n // Turn on component tap events only if not using native controls\n if (!options.nativeControlsForTouch) {\n _this.emitTapEvents();\n }\n\n if (_this.constructor) {\n _this.name_ = _this.constructor.name || 'Unknown Tech';\n }\n return _this;\n }\n\n /**\n * A special function to trigger source set in a way that will allow player\n * to re-trigger if the player or tech are not ready yet.\n *\n * @fires Tech#sourceset\n * @param {string} src The source string at the time of the source changing.\n */\n\n\n Tech.prototype.triggerSourceset = function triggerSourceset(src) {\n var _this2 = this;\n\n if (!this.isReady_) {\n // on initial ready we have to trigger source set\n // 1ms after ready so that player can watch for it.\n this.one('ready', function () {\n return _this2.setTimeout(function () {\n return _this2.triggerSourceset(src);\n }, 1);\n });\n }\n\n /**\n * Fired when the source is set on the tech causing the media element\n * to reload.\n *\n * @see {@link Player#event:sourceset}\n * @event Tech#sourceset\n * @type {EventTarget~Event}\n */\n this.trigger({\n src: src,\n type: 'sourceset'\n });\n };\n\n /* Fallbacks for unsupported event types\n ================================================================================ */\n\n /**\n * Polyfill the `progress` event for browsers that don't support it natively.\n *\n * @see {@link Tech#trackProgress}\n */\n\n\n Tech.prototype.manualProgressOn = function manualProgressOn() {\n this.on('durationchange', this.onDurationChange);\n\n this.manualProgress = true;\n\n // Trigger progress watching when a source begins loading\n this.one('ready', this.trackProgress);\n };\n\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n */\n\n\n Tech.prototype.manualProgressOff = function manualProgressOff() {\n this.manualProgress = false;\n this.stopTrackingProgress();\n\n this.off('durationchange', this.onDurationChange);\n };\n\n /**\n * This is used to trigger a `progress` event when the buffered percent changes. It\n * sets an interval function that will be called every 500 milliseconds to check if the\n * buffer end percent has changed.\n *\n * > This function is called by {@link Tech#manualProgressOn}\n *\n * @param {EventTarget~Event} event\n * The `ready` event that caused this to run.\n *\n * @listens Tech#ready\n * @fires Tech#progress\n */\n\n\n Tech.prototype.trackProgress = function trackProgress(event) {\n this.stopTrackingProgress();\n this.progressInterval = this.setInterval(bind(this, function () {\n // Don't trigger unless buffered amount is greater than last time\n\n var numBufferedPercent = this.bufferedPercent();\n\n if (this.bufferedPercent_ !== numBufferedPercent) {\n /**\n * See {@link Player#progress}\n *\n * @event Tech#progress\n * @type {EventTarget~Event}\n */\n this.trigger('progress');\n }\n\n this.bufferedPercent_ = numBufferedPercent;\n\n if (numBufferedPercent === 1) {\n this.stopTrackingProgress();\n }\n }), 500);\n };\n\n /**\n * Update our internal duration on a `durationchange` event by calling\n * {@link Tech#duration}.\n *\n * @param {EventTarget~Event} event\n * The `durationchange` event that caused this to run.\n *\n * @listens Tech#durationchange\n */\n\n\n Tech.prototype.onDurationChange = function onDurationChange(event) {\n this.duration_ = this.duration();\n };\n\n /**\n * Get and create a `TimeRange` object for buffering.\n *\n * @return {TimeRange}\n * The time range object that was created.\n */\n\n\n Tech.prototype.buffered = function buffered() {\n return createTimeRanges(0, 0);\n };\n\n /**\n * Get the percentage of the current video that is currently buffered.\n *\n * @return {number}\n * A number from 0 to 1 that represents the decimal percentage of the\n * video that is buffered.\n *\n */\n\n\n Tech.prototype.bufferedPercent = function bufferedPercent$$1() {\n return bufferedPercent(this.buffered(), this.duration_);\n };\n\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n * Stop manually tracking progress events by clearing the interval that was set in\n * {@link Tech#trackProgress}.\n */\n\n\n Tech.prototype.stopTrackingProgress = function stopTrackingProgress() {\n this.clearInterval(this.progressInterval);\n };\n\n /**\n * Polyfill the `timeupdate` event for browsers that don't support it.\n *\n * @see {@link Tech#trackCurrentTime}\n */\n\n\n Tech.prototype.manualTimeUpdatesOn = function manualTimeUpdatesOn() {\n this.manualTimeUpdates = true;\n\n this.on('play', this.trackCurrentTime);\n this.on('pause', this.stopTrackingCurrentTime);\n };\n\n /**\n * Turn off the polyfill for `timeupdate` events that was created in\n * {@link Tech#manualTimeUpdatesOn}\n */\n\n\n Tech.prototype.manualTimeUpdatesOff = function manualTimeUpdatesOff() {\n this.manualTimeUpdates = false;\n this.stopTrackingCurrentTime();\n this.off('play', this.trackCurrentTime);\n this.off('pause', this.stopTrackingCurrentTime);\n };\n\n /**\n * Sets up an interval function to track current time and trigger `timeupdate` every\n * 250 milliseconds.\n *\n * @listens Tech#play\n * @triggers Tech#timeupdate\n */\n\n\n Tech.prototype.trackCurrentTime = function trackCurrentTime() {\n if (this.currentTimeInterval) {\n this.stopTrackingCurrentTime();\n }\n this.currentTimeInterval = this.setInterval(function () {\n /**\n * Triggered at an interval of 250ms to indicated that time is passing in the video.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });\n\n // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n }, 250);\n };\n\n /**\n * Stop the interval function created in {@link Tech#trackCurrentTime} so that the\n * `timeupdate` event is no longer triggered.\n *\n * @listens {Tech#pause}\n */\n\n\n Tech.prototype.stopTrackingCurrentTime = function stopTrackingCurrentTime() {\n this.clearInterval(this.currentTimeInterval);\n\n // #1002 - if the video ends right before the next timeupdate would happen,\n // the progress bar won't make it all the way to the end\n this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });\n };\n\n /**\n * Turn off all event polyfills, clear the `Tech`s {@link AudioTrackList},\n * {@link VideoTrackList}, and {@link TextTrackList}, and dispose of this Tech.\n *\n * @fires Component#dispose\n */\n\n\n Tech.prototype.dispose = function dispose() {\n\n // clear out all tracks because we can't reuse them between techs\n this.clearTracks(NORMAL.names);\n\n // Turn off any manual progress or timeupdate tracking\n if (this.manualProgress) {\n this.manualProgressOff();\n }\n\n if (this.manualTimeUpdates) {\n this.manualTimeUpdatesOff();\n }\n\n _Component.prototype.dispose.call(this);\n };\n\n /**\n * Clear out a single `TrackList` or an array of `TrackLists` given their names.\n *\n * > Note: Techs without source handlers should call this between sources for `video`\n * & `audio` tracks. You don't want to use them between tracks!\n *\n * @param {string[]|string} types\n * TrackList names to clear, valid names are `video`, `audio`, and\n * `text`.\n */\n\n\n Tech.prototype.clearTracks = function clearTracks(types) {\n var _this3 = this;\n\n types = [].concat(types);\n // clear out all tracks because we can't reuse them between techs\n types.forEach(function (type) {\n var list = _this3[type + 'Tracks']() || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n\n if (type === 'text') {\n _this3.removeRemoteTextTrack(track);\n }\n list.removeTrack(track);\n }\n });\n };\n\n /**\n * Remove any TextTracks added via addRemoteTextTrack that are\n * flagged for automatic garbage collection\n */\n\n\n Tech.prototype.cleanupAutoTextTracks = function cleanupAutoTextTracks() {\n var list = this.autoRemoteTextTracks_ || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n\n this.removeRemoteTextTrack(track);\n }\n };\n\n /**\n * Reset the tech, which will removes all sources and reset the internal readyState.\n *\n * @abstract\n */\n\n\n Tech.prototype.reset = function reset() {};\n\n /**\n * Get or set an error on the Tech.\n *\n * @param {MediaError} [err]\n * Error to set on the Tech\n *\n * @return {MediaError|null}\n * The current error object on the tech, or null if there isn't one.\n */\n\n\n Tech.prototype.error = function error(err) {\n if (err !== undefined) {\n this.error_ = new MediaError(err);\n this.trigger('error');\n }\n return this.error_;\n };\n\n /**\n * Returns the `TimeRange`s that have been played through for the current source.\n *\n * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`.\n * It only checks wether the source has played at all or not.\n *\n * @return {TimeRange}\n * - A single time range if this video has played\n * - An empty set of ranges if not.\n */\n\n\n Tech.prototype.played = function played() {\n if (this.hasStarted_) {\n return createTimeRanges(0, 0);\n }\n return createTimeRanges();\n };\n\n /**\n * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was\n * previously called.\n *\n * @fires Tech#timeupdate\n */\n\n\n Tech.prototype.setCurrentTime = function setCurrentTime() {\n // improve the accuracy of manual timeupdates\n if (this.manualTimeUpdates) {\n /**\n * A manual `timeupdate` event.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });\n }\n };\n\n /**\n * Turn on listeners for {@link VideoTrackList}, {@link {AudioTrackList}, and\n * {@link TextTrackList} events.\n *\n * This adds {@link EventTarget~EventListeners} for `addtrack`, and `removetrack`.\n *\n * @fires Tech#audiotrackchange\n * @fires Tech#videotrackchange\n * @fires Tech#texttrackchange\n */\n\n\n Tech.prototype.initTrackListeners = function initTrackListeners() {\n var _this4 = this;\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link AudioTrackList}\n *\n * @event Tech#audiotrackchange\n * @type {EventTarget~Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link VideoTrackList}\n *\n * @event Tech#videotrackchange\n * @type {EventTarget~Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link TextTrackList}\n *\n * @event Tech#texttrackchange\n * @type {EventTarget~Event}\n */\n NORMAL.names.forEach(function (name) {\n var props = NORMAL[name];\n var trackListChanges = function trackListChanges() {\n _this4.trigger(name + 'trackchange');\n };\n\n var tracks = _this4[props.getterName]();\n\n tracks.addEventListener('removetrack', trackListChanges);\n tracks.addEventListener('addtrack', trackListChanges);\n\n _this4.on('dispose', function () {\n tracks.removeEventListener('removetrack', trackListChanges);\n tracks.removeEventListener('addtrack', trackListChanges);\n });\n });\n };\n\n /**\n * Emulate TextTracks using vtt.js if necessary\n *\n * @fires Tech#vttjsloaded\n * @fires Tech#vttjserror\n */\n\n\n Tech.prototype.addWebVttScript_ = function addWebVttScript_() {\n var _this5 = this;\n\n if (window.WebVTT) {\n return;\n }\n\n // Initially, Tech.el_ is a child of a dummy-div wait until the Component system\n // signals that the Tech is ready at which point Tech.el_ is part of the DOM\n // before inserting the WebVTT script\n if (document.body.contains(this.el())) {\n\n // load via require if available and vtt.js script location was not passed in\n // as an option. novtt builds will turn the above require call into an empty object\n // which will cause this if check to always fail.\n if (!this.options_['vtt.js'] && isPlain(vtt) && Object.keys(vtt).length > 0) {\n this.trigger('vttjsloaded');\n return;\n }\n\n // load vtt.js via the script location option or the cdn of no location was\n // passed in\n var script = document.createElement('script');\n\n script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js';\n script.onload = function () {\n /**\n * Fired when vtt.js is loaded.\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this5.trigger('vttjsloaded');\n };\n script.onerror = function () {\n /**\n * Fired when vtt.js was not loaded due to an error\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this5.trigger('vttjserror');\n };\n this.on('dispose', function () {\n script.onload = null;\n script.onerror = null;\n });\n // but have not loaded yet and we set it to true before the inject so that\n // we don't overwrite the injected window.WebVTT if it loads right away\n window.WebVTT = true;\n this.el().parentNode.appendChild(script);\n } else {\n this.ready(this.addWebVttScript_);\n }\n };\n\n /**\n * Emulate texttracks\n *\n */\n\n\n Tech.prototype.emulateTextTracks = function emulateTextTracks() {\n var _this6 = this;\n\n var tracks = this.textTracks();\n var remoteTracks = this.remoteTextTracks();\n var handleAddTrack = function handleAddTrack(e) {\n return tracks.addTrack(e.track);\n };\n var handleRemoveTrack = function handleRemoveTrack(e) {\n return tracks.removeTrack(e.track);\n };\n\n remoteTracks.on('addtrack', handleAddTrack);\n remoteTracks.on('removetrack', handleRemoveTrack);\n\n this.addWebVttScript_();\n\n var updateDisplay = function updateDisplay() {\n return _this6.trigger('texttrackchange');\n };\n\n var textTracksChanges = function textTracksChanges() {\n updateDisplay();\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n\n track.removeEventListener('cuechange', updateDisplay);\n if (track.mode === 'showing') {\n track.addEventListener('cuechange', updateDisplay);\n }\n }\n };\n\n textTracksChanges();\n tracks.addEventListener('change', textTracksChanges);\n tracks.addEventListener('addtrack', textTracksChanges);\n tracks.addEventListener('removetrack', textTracksChanges);\n\n this.on('dispose', function () {\n remoteTracks.off('addtrack', handleAddTrack);\n remoteTracks.off('removetrack', handleRemoveTrack);\n tracks.removeEventListener('change', textTracksChanges);\n tracks.removeEventListener('addtrack', textTracksChanges);\n tracks.removeEventListener('removetrack', textTracksChanges);\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n\n track.removeEventListener('cuechange', updateDisplay);\n }\n });\n };\n\n /**\n * Create and returns a remote {@link TextTrack} object.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @return {TextTrack}\n * The TextTrack that gets created.\n */\n\n\n Tech.prototype.addTextTrack = function addTextTrack(kind, label, language) {\n if (!kind) {\n throw new Error('TextTrack kind is required but was not provided');\n }\n\n return createTrackHelper(this, kind, label, language);\n };\n\n /**\n * Create an emulated TextTrack for use by addRemoteTextTrack\n *\n * This is intended to be overridden by classes that inherit from\n * Tech in order to create native or custom TextTracks.\n *\n * @param {Object} options\n * The object should contain the options to initialize the TextTrack with.\n *\n * @param {string} [options.kind]\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).\n *\n * @param {string} [options.label].\n * Label to identify the text track\n *\n * @param {string} [options.language]\n * Two letter language abbreviation.\n *\n * @return {HTMLTrackElement}\n * The track element that gets created.\n */\n\n\n Tech.prototype.createRemoteTextTrack = function createRemoteTextTrack(options) {\n var track = mergeOptions(options, {\n tech: this\n });\n\n return new REMOTE.remoteTextEl.TrackClass(track);\n };\n\n /**\n * Creates a remote text track object and returns an html track element.\n *\n * > Note: This can be an emulated {@link HTMLTrackElement} or a native one.\n *\n * @param {Object} options\n * See {@link Tech#createRemoteTextTrack} for more detailed properties.\n *\n * @param {boolean} [manualCleanup=true]\n * - When false: the TextTrack will be automatically removed from the video\n * element whenever the source changes\n * - When True: The TextTrack will have to be cleaned up manually\n *\n * @return {HTMLTrackElement}\n * An Html Track Element.\n *\n * @deprecated The default functionality for this function will be equivalent\n * to \"manualCleanup=false\" in the future. The manualCleanup parameter will\n * also be removed.\n */\n\n\n Tech.prototype.addRemoteTextTrack = function addRemoteTextTrack() {\n var _this7 = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var manualCleanup = arguments[1];\n\n var htmlTrackElement = this.createRemoteTextTrack(options);\n\n if (manualCleanup !== true && manualCleanup !== false) {\n // deprecation warning\n log.warn('Calling addRemoteTextTrack without explicitly setting the \"manualCleanup\" parameter to `true` is deprecated and default to `false` in future version of video.js');\n manualCleanup = true;\n }\n\n // store HTMLTrackElement and TextTrack to remote list\n this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);\n this.remoteTextTracks().addTrack(htmlTrackElement.track);\n\n if (manualCleanup !== true) {\n // create the TextTrackList if it doesn't exist\n this.ready(function () {\n return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);\n });\n }\n\n return htmlTrackElement;\n };\n\n /**\n * Remove a remote text track from the remote `TextTrackList`.\n *\n * @param {TextTrack} track\n * `TextTrack` to remove from the `TextTrackList`\n */\n\n\n Tech.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) {\n var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);\n\n // remove HTMLTrackElement and TextTrack from remote list\n this.remoteTextTrackEls().removeTrackElement_(trackElement);\n this.remoteTextTracks().removeTrack(track);\n this.autoRemoteTextTracks_.removeTrack(track);\n };\n\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object}\n * An object with supported media playback quality metrics\n *\n * @abstract\n */\n\n\n Tech.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() {\n return {};\n };\n\n /**\n * A method to set a poster from a `Tech`.\n *\n * @abstract\n */\n\n\n Tech.prototype.setPoster = function setPoster() {};\n\n /**\n * A method to check for the presence of the 'playsinine'